diff options
author | Ted Gould <ted@gould.cx> | 2010-01-04 12:09:06 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-04 12:09:06 -0600 |
commit | 719e6a0754ab40a4c1ca3b9694dce694dc66a032 (patch) | |
tree | ab219a816f165aa7affd9244bf6f11464e63aadb | |
parent | cde9919d53e85c76a9d26989ef3f23df640973cd (diff) | |
download | ayatana-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.
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | src/session-service.c | 33 |
2 files changed, 21 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index a358f24..08e2bce 100644 --- a/configure.ac +++ b/configure.ac @@ -37,20 +37,9 @@ AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) DBUSMENUGLIB_REQUIRED_VERSION=0.1.1 -TELEPATHYGLIB_REQUIRED_VERSION=0.9.0 -PKG_CHECK_MODULES(STATUSSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION - telepathy-glib >= $TELEPATHYGLIB_REQUIRED_VERSION) - -AC_SUBST(STATUSERVICE_CFLAGS) -AC_SUBST(STATUSERVICE_LIBS) - -PKG_CHECK_MODULES(USERSSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION) - -AC_SUBST(USERSERVICE_CFLAGS) -AC_SUBST(USERSERVICE_LIBS) - -PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION) +PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION + indicator >= $INDICATOR_REQUIRED_VERSION) AC_SUBST(SESSIONERVICE_CFLAGS) AC_SUBST(SESSIONERVICE_LIBS) 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); |