From ddb2ab7cba0d8b2c7ea5171595e06c04520f4b81 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 2 Nov 2009 16:08:04 -0600 Subject: Adding a fallback to the session bus after trying the starter bus. --- libindicator/indicator-service.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'libindicator/indicator-service.c') diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 4cc99d2..ff0bd03 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -116,14 +116,24 @@ indicator_service_init (IndicatorService *self) /* Start talkin' dbus */ GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); + g_error("Unable to get starter bus: %s", error->message); g_error_free(error); - return; + + /* Okay, fine let's try the session bus then. */ + /* I think this should automatically, but I can't find confirmation + of that, so we're putting the extra little code in here. */ + error = NULL; + bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (error != NULL) { + g_error("Unable to get session bus: %s", error->message); + g_error_free(error); + return; + } } - priv->dbus_proxy = dbus_g_proxy_new_for_name_owner(session_bus, + priv->dbus_proxy = dbus_g_proxy_new_for_name_owner(bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, @@ -134,7 +144,7 @@ indicator_service_init (IndicatorService *self) return; } - dbus_g_connection_register_g_object(session_bus, + dbus_g_connection_register_g_object(bus, INDICATOR_SERVICE_OBJECT, G_OBJECT(self)); -- cgit v1.2.3