aboutsummaryrefslogtreecommitdiff
path: root/libindicator/indicator-service-manager.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-30 15:58:57 -0500
committerTed Gould <ted@canonical.com>2009-10-30 15:58:57 -0500
commitaa1549d81d1d0eb1f92d4fb5b0339ba4ceab72cd (patch)
treeacda039e8c105a6e8b9d335a5cd99bb7fc793997 /libindicator/indicator-service-manager.c
parenta9e61b6f6196c06f79791de768e426b3e6539cec (diff)
downloadlibayatana-indicator-aa1549d81d1d0eb1f92d4fb5b0339ba4ceab72cd.tar.gz
libayatana-indicator-aa1549d81d1d0eb1f92d4fb5b0339ba4ceab72cd.tar.bz2
libayatana-indicator-aa1549d81d1d0eb1f92d4fb5b0339ba4ceab72cd.zip
Adding in the connected property and signalling when we're all hooked up.
Diffstat (limited to 'libindicator/indicator-service-manager.c')
-rw-r--r--libindicator/indicator-service-manager.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index 321b026..2d668ff 100644
--- a/libindicator/indicator-service-manager.c
+++ b/libindicator/indicator-service-manager.c
@@ -15,6 +15,7 @@ struct _IndicatorServiceManagerPrivate {
gchar * name;
DBusGProxy * dbus_proxy;
DBusGProxy * service_proxy;
+ gboolean connected;
};
/* Signals Stuff */
@@ -103,6 +104,7 @@ indicator_service_manager_init (IndicatorServiceManager *self)
priv->name = NULL;
priv->dbus_proxy = NULL;
priv->service_proxy = NULL;
+ priv->connected = FALSE;
/* Start talkin' dbus */
GError * error = NULL;
@@ -132,16 +134,26 @@ indicator_service_manager_dispose (GObject *object)
{
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(object);
+ /* If we were connected we need to make sure to
+ tell people that it's no longer the case. */
+ if (priv->connected) {
+ priv->connected = FALSE;
+ g_signal_emit(object, signals[CONNECTION_CHANGE], 0, FALSE, TRUE);
+ }
+
+ /* Destory our DBus proxy, we won't need it. */
if (priv->dbus_proxy != NULL) {
g_object_unref(G_OBJECT(priv->dbus_proxy));
priv->dbus_proxy = NULL;
}
+ /* Destory our service proxy, we won't need it. */
if (priv->service_proxy != NULL) {
g_object_unref(G_OBJECT(priv->service_proxy));
priv->service_proxy = NULL;
}
+ /* Let's see if our parents want to do anything. */
G_OBJECT_CLASS (indicator_service_manager_parent_class)->dispose (object);
return;
}
@@ -230,6 +242,16 @@ watch_cb (DBusGProxy * proxy, gint version, GError * error, gpointer user_data)
return;
}
+ if (version != INDICATOR_SERVICE_VERSION) {
+ g_error("Service is using a different version of the service interface. Expecting %d and got %d.", INDICATOR_SERVICE_VERSION, version);
+ return;
+ }
+
+ if (!priv->connected) {
+ priv->connected = TRUE;
+ g_signal_emit(G_OBJECT(user_data), signals[CONNECTION_CHANGE], 0, TRUE, TRUE);
+ }
+
return;
}