diff options
author | Ted Gould <ted@gould.cx> | 2009-12-01 16:07:26 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-01 16:07:26 -0600 |
commit | b7864d8626cd5bdde3fe94f2086d9a1cfdb66a49 (patch) | |
tree | b66887f0803fae080c31cc2533f1ad36f89f7f5e /libindicator | |
parent | 4ba1af342c78aefdf5dc163163c80de6b25f85ec (diff) | |
download | libayatana-indicator-b7864d8626cd5bdde3fe94f2086d9a1cfdb66a49.tar.gz libayatana-indicator-b7864d8626cd5bdde3fe94f2086d9a1cfdb66a49.tar.bz2 libayatana-indicator-b7864d8626cd5bdde3fe94f2086d9a1cfdb66a49.zip |
Only getting the bus once.
Diffstat (limited to 'libindicator')
-rw-r--r-- | libindicator/indicator-service-manager.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index 4dcc200..13c9015 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -16,6 +16,7 @@ struct _IndicatorServiceManagerPrivate { DBusGProxy * dbus_proxy; DBusGProxy * service_proxy; gboolean connected; + DBusGConnection * bus; }; /* Signals Stuff */ @@ -106,17 +107,18 @@ indicator_service_manager_init (IndicatorServiceManager *self) priv->dbus_proxy = NULL; priv->service_proxy = NULL; priv->connected = FALSE; + priv->bus = NULL; /* Start talkin' dbus */ GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + priv->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(priv->bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, @@ -285,14 +287,7 @@ start_service_cb (DBusGProxy * proxy, guint status, GError * error, gpointer use } /* Woot! it's running. Let's do it some more. */ - DBusGConnection * session_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->service_proxy = dbus_g_proxy_new_for_name_owner(session_bus, + priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, priv->name, INDICATOR_SERVICE_OBJECT, INDICATOR_SERVICE_INTERFACE, @@ -315,15 +310,7 @@ start_service (IndicatorServiceManager * service) g_return_if_fail(priv->name != NULL); /* Check to see if we can get a proxy to it first. */ - DBusGConnection * session_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; - } - - /* Tries to get the proxy first. */ - priv->service_proxy = dbus_g_proxy_new_for_name_owner(session_bus, + priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus, priv->name, INDICATOR_SERVICE_OBJECT, INDICATOR_SERVICE_INTERFACE, |