From 719e6a0754ab40a4c1ca3b9694dce694dc66a032 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 4 Jan 2010 12:09:06 -0600 Subject: Switching the session service to using a IndicatorService object. --- src/session-service.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/session-service.c b/src/session-service.c index 7acaef5..65d8837 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -32,6 +32,8 @@ with this program. If not, see . #include #include +#include + #include "dbus-shared-names.h" #include "gtk-dialog/gconf-helper.h" @@ -297,6 +299,18 @@ create_items (DbusmenuMenuitem * root) { return; } +/* When the service interface starts to shutdown, we + should follow it. */ +void +service_shutdown (IndicatorService * service, gpointer user_data) +{ + if (mainloop != NULL) { + g_debug("Service shutdown"); + g_main_loop_quit(mainloop); + } + return; +} + /* Main, is well, main. It brings everything up and throws us into the mainloop of no return. */ int @@ -310,20 +324,11 @@ main (int argc, char ** argv) bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain (GETTEXT_PACKAGE); - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - GError * error = NULL; - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, INDICATOR_SESSION_DBUS_NAME, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } + IndicatorService * service = indicator_service_new_version(INDICATOR_SESSION_DBUS_NAME, + INDICATOR_SESSION_DBUS_VERSION); + g_signal_connect(G_OBJECT(service), + INDICATOR_SERVICE_SIGNAL_SHUTDOWN, + G_CALLBACK(service_shutdown), NULL); g_idle_add(lock_screen_setup, NULL); -- cgit v1.2.3