diff options
author | Ted Gould <ted@gould.cx> | 2010-02-25 11:56:16 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-25 11:56:16 -0600 |
commit | 6efdf35b5e3bfc25fa937b49c74f08d255aeb63c (patch) | |
tree | 6b25182d289609bba65170e18bfd70c9528e0320 /src/gtk-dialog/gtk-logout-helper.c | |
parent | c9231bfee1c1ff91c20a76ba2f46a8d660ee1c67 (diff) | |
parent | ab02e295a6e21e1acb577516f0796d0ff4cc7092 (diff) | |
download | ayatana-indicator-session-6efdf35b5e3bfc25fa937b49c74f08d255aeb63c.tar.gz ayatana-indicator-session-6efdf35b5e3bfc25fa937b49c74f08d255aeb63c.tar.bz2 ayatana-indicator-session-6efdf35b5e3bfc25fa937b49c74f08d255aeb63c.zip |
* Upstream release 0.2.4
* When we can't shutdown with gnome-session fallback to using
ConsoleKit.
* Detect when GPM isn't available and don't error out.
* Change suspend and hibernate detection property names for
adjustment to upower.
Diffstat (limited to 'src/gtk-dialog/gtk-logout-helper.c')
-rw-r--r-- | src/gtk-dialog/gtk-logout-helper.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gtk-dialog/gtk-logout-helper.c b/src/gtk-dialog/gtk-logout-helper.c index d8aea6b..4c6614c 100644 --- a/src/gtk-dialog/gtk-logout-helper.c +++ b/src/gtk-dialog/gtk-logout-helper.c @@ -30,6 +30,44 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "gconf-helper.h" static void +consolekit_fallback (LogoutDialogAction action) +{ + DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + g_return_if_fail(sbus != NULL); /* worst case */ + DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit", + "/org/freedesktop/ConsoleKit/Manager", + "org.freedesktop.ConsoleKit.Manager"); + + if (proxy == NULL) { + g_warning("Unable to get consolekit proxy"); + return; + } + + switch (action) { + case LOGOUT_DIALOG_LOGOUT: + g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler."); + break; + case LOGOUT_DIALOG_SHUTDOWN: + dbus_g_proxy_call_no_reply(proxy, + "Stop", + G_TYPE_INVALID); + break; + case LOGOUT_DIALOG_RESTART: + dbus_g_proxy_call_no_reply(proxy, + "Restart", + G_TYPE_INVALID); + break; + default: + g_warning("Unknown action"); + break; + } + + g_object_unref(proxy); + + return; +} + +static void session_action (LogoutDialogAction action) { DBusGConnection * sbus; @@ -50,6 +88,8 @@ session_action (LogoutDialogAction action) if (sm_proxy == NULL) { g_warning("Unable to get DBus proxy to SessionManager interface: %s", error->message); g_error_free(error); + + consolekit_fallback(action); return; } |