From 13000713f0b8fa3cc7ea7a8689f90d3241a35d2a Mon Sep 17 00:00:00 2001
From: Iain Lane <iain.lane@canonical.com>
Date: Mon, 29 Apr 2013 22:01:41 +0000
Subject: [PATCH] Use logind for powering off too
---
mythtv/programs/mythfrontend/exitprompt.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/mythtv/programs/mythfrontend/exitprompt.cpp b/mythtv/programs/mythfrontend/exitprompt.cpp
index 266a8d9..af45702 100644
|
a
|
b
|
static bool DBusHalt(void)
|
| 33 | 33 | "/org/freedesktop/ConsoleKit/Manager", |
| 34 | 34 | "org.freedesktop.ConsoleKit.Manager", |
| 35 | 35 | QDBusConnection::systemBus()); |
| | 36 | QDBusInterface logind("org.freedesktop.login1", |
| | 37 | "/org/freedesktop/login1", |
| | 38 | "org.freedesktop.login1.Manager", |
| | 39 | QDBusConnection::systemBus()); |
| 36 | 40 | QDBusInterface hal("org.freedesktop.Hal", |
| 37 | 41 | "/org/freedesktop/Hal/devices/computer", |
| 38 | 42 | "org.freedesktop.Hal.Device.SystemPowerManagement", |
| … |
… |
static bool DBusHalt(void)
|
| 41 | 45 | QDBusReply<void> void_reply = kde.call("logout", 0, 2, 2); |
| 42 | 46 | QDBusReply<bool> bool_reply; |
| 43 | 47 | QDBusReply<int> int_reply; |
| | 48 | QDBusReply<QString> string_reply; |
| 44 | 49 | |
| 45 | 50 | if (!void_reply.isValid()) |
| 46 | 51 | { |
| | 52 | bool_reply = logind.call("CanPowerOff"); |
| | 53 | if (string_reply.isValid() && string_reply.value() == "yes") |
| | 54 | void_reply = logind.call("PowerOff", false); |
| | 55 | } |
| | 56 | if (!void_reply.isValid()) |
| | 57 | { |
| 47 | 58 | bool_reply = gnome.call("CanShutdown"); |
| 48 | 59 | if (bool_reply.isValid() && bool_reply.value() == 1) |
| 49 | 60 | void_reply = gnome.call("RequestShutdown"); |