From c4a5e5cf9dabce8c58bc5e7ef4cfe79095d012df Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 8 Aug 2009 10:47:24 -0600 Subject: Fixing a few things with the dbus stuff and starting to listen to the extra information on the service. --- src/dbus-shared-names.h | 2 +- src/indicator-sus.c | 26 ++++++++++++++++++++++++++ src/status-service-dbus.c | 2 +- src/status-service.xml | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 9c828b1..6eb261f 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -26,7 +26,7 @@ with this program. If not, see . #define INDICATOR_STATUS_DBUS_NAME "org.ayatana.indicator.status" #define INDICATOR_STATUS_DBUS_OBJECT "/org/ayatana/indicator/status" -#define INDICATOR_STATUS_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/statusservice" +#define INDICATOR_STATUS_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.status.service" #define INDICATOR_USERS_DBUS_NAME "org.ayatana.indicator.users" #define INDICATOR_USERS_DBUS_OBJECT "/org/ayatana/indicator/users" diff --git a/src/indicator-sus.c b/src/indicator-sus.c index 1ab810c..24629d6 100644 --- a/src/indicator-sus.c +++ b/src/indicator-sus.c @@ -47,6 +47,7 @@ static GtkWidget * loading_item = NULL; static DBusGConnection * connection = NULL; static DBusGProxy * proxy = NULL; +static DBusGProxy * status_proxy = NULL; typedef enum { STATUS_SECTION, @@ -179,6 +180,29 @@ status_menu_root_changed(DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, return; } +static gboolean +connect_to_status (gpointer userdata) +{ + if (status_proxy == NULL) { + GError * error = NULL; + + DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + + status_proxy = dbus_g_proxy_new_for_name_owner(sbus, + INDICATOR_STATUS_DBUS_NAME, + INDICATOR_STATUS_DBUS_OBJECT, + INDICATOR_STATUS_SERVICE_DBUS_INTERFACE, + &error); + + if (error != NULL) { + g_warning("Unable to get status proxy: %s", error->message); + g_error_free(error); + } + } + + return FALSE; +} + static gboolean build_status_menu (gpointer userdata) { @@ -209,6 +233,8 @@ build_status_menu (gpointer userdata) gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), status_separator); gtk_widget_hide(status_separator); /* Should be default, I'm just being explicit. $(%*#$ hide already! */ + g_idle_add(connect_to_status, NULL); + return FALSE; } diff --git a/src/status-service-dbus.c b/src/status-service-dbus.c index 09d2711..f93980f 100644 --- a/src/status-service-dbus.c +++ b/src/status-service-dbus.c @@ -116,7 +116,7 @@ status_service_dbus_init (StatusServiceDbus *self) DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); dbus_g_connection_register_g_object(connection, - INDICATOR_STATUS_SERVICE_DBUS_OBJECT, + INDICATOR_STATUS_DBUS_OBJECT, G_OBJECT(self)); StatusServiceDbusPrivate * priv = STATUS_SERVICE_DBUS_GET_PRIVATE(self); diff --git a/src/status-service.xml b/src/status-service.xml index ba1f79f..977b338 100644 --- a/src/status-service.xml +++ b/src/status-service.xml @@ -1,6 +1,6 @@ - + -- cgit v1.2.3