aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-03 16:18:00 -0600
committerTed Gould <ted@gould.cx>2010-03-03 16:18:00 -0600
commit2ae450d4f50ed3da4383ad5e4fcd470986deee3b (patch)
tree4ebe47b7891693d0c8fb340199b4bee8376518a8
parent68d13604c069937cdb1e6cab3ecd54cfb45fc593 (diff)
downloadayatana-indicator-session-2ae450d4f50ed3da4383ad5e4fcd470986deee3b.tar.gz
ayatana-indicator-session-2ae450d4f50ed3da4383ad5e4fcd470986deee3b.tar.bz2
ayatana-indicator-session-2ae450d4f50ed3da4383ad5e4fcd470986deee3b.zip
Filling in the code to check and see if we can restart or stop.
-rw-r--r--src/dialog.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/dialog.c b/src/dialog.c
index 7e2347e..6dd7a90 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -4,6 +4,7 @@
#include <glib/gi18n.h>
+#include "consolekit-manager-client.h"
#include "dialog.h"
/* Strings */
@@ -106,10 +107,30 @@ check_restart_required (void)
static gboolean
ck_check_allowed (LogoutDialogType type)
{
+ DBusGConnection * system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
+ g_return_val_if_fail(system_bus != NULL, TRUE);
+
+ DBusGProxy * ck_proxy = dbus_g_proxy_new_for_name (system_bus,
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager");
+ g_return_val_if_fail(ck_proxy != NULL, TRUE);
+
+ gboolean retval = TRUE;
+ switch (type) {
+ case LOGOUT_DIALOG_TYPE_RESTART:
+ org_freedesktop_ConsoleKit_Manager_can_restart(ck_proxy, &retval, NULL);
+ break;
+ case LOGOUT_DIALOG_TYPE_SHUTDOWN:
+ org_freedesktop_ConsoleKit_Manager_can_stop(ck_proxy, &retval, NULL);
+ break;
+ default:
+ break;
+ }
+ g_object_unref(ck_proxy);
-
- return TRUE;
+ return retval;
}
LogoutDialog *