aboutsummaryrefslogtreecommitdiff
path: root/src/dialog.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-12 00:39:31 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-12 00:39:31 -0500
commit192be127691af87a88f4ac15d4fe3dd9296499b0 (patch)
tree7fb4f18f34eb213bc40fccf6c2bf97de2cc769f7 /src/dialog.c
parentf7f945beb6353195c84d5d897a20fcc26d243058 (diff)
downloadayatana-indicator-session-192be127691af87a88f4ac15d4fe3dd9296499b0.tar.gz
ayatana-indicator-session-192be127691af87a88f4ac15d4fe3dd9296499b0.tar.bz2
ayatana-indicator-session-192be127691af87a88f4ac15d4fe3dd9296499b0.zip
use GDBus in users-service-dbus.c... major rewrite here.
Diffstat (limited to 'src/dialog.c')
-rw-r--r--src/dialog.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/dialog.c b/src/dialog.c
index 4b139ca..5686a95 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n.h>
-#include "consolekit-manager-client.h"
+#include "dbus-consolekit-manager.h"
#include "dialog.h"
/* Strings */
@@ -137,30 +137,31 @@ 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;
- }
+ gboolean allowed = TRUE;
+
+ ConsoleKitManager * ck_proxy = console_kit_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ NULL,
+ NULL);
+ if (ck_proxy != NULL)
+ {
+ switch (type) {
+ case LOGOUT_DIALOG_TYPE_RESTART:
+ console_kit_manager_call_can_restart_sync (ck_proxy, &allowed, NULL, NULL);
+ break;
+ case LOGOUT_DIALOG_TYPE_SHUTDOWN:
+ console_kit_manager_call_can_stop_sync (ck_proxy, &allowed, NULL, NULL);
+ break;
+ default:
+ break;
+ }
- g_object_unref(ck_proxy);
+ g_object_unref(ck_proxy);
+ }
- return retval;
+ return allowed;
}
LogoutDialog *