aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-04 12:09:06 -0600
committerTed Gould <ted@gould.cx>2010-01-04 12:09:06 -0600
commit719e6a0754ab40a4c1ca3b9694dce694dc66a032 (patch)
treeab219a816f165aa7affd9244bf6f11464e63aadb /src
parentcde9919d53e85c76a9d26989ef3f23df640973cd (diff)
downloadayatana-indicator-session-719e6a0754ab40a4c1ca3b9694dce694dc66a032.tar.gz
ayatana-indicator-session-719e6a0754ab40a4c1ca3b9694dce694dc66a032.tar.bz2
ayatana-indicator-session-719e6a0754ab40a4c1ca3b9694dce694dc66a032.zip
Switching the session service to using a IndicatorService object.
Diffstat (limited to 'src')
-rw-r--r--src/session-service.c33
1 files changed, 19 insertions, 14 deletions
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 <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/menuitem.h>
+#include <libindicator/indicator-service.h>
+
#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);