aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-12 14:34:50 -0500
committerTed Gould <ted@gould.cx>2011-07-12 14:34:50 -0500
commit2e66ca5c013f2f37fc274c9d02b714fe6d21928e (patch)
tree8faa76240e31140c4395eced0e47ae78b32f9e23 /libindicator
parent1838bfc6981fec3b0131e28cdbddb9cb4e4b0ec8 (diff)
downloadlibayatana-indicator-2e66ca5c013f2f37fc274c9d02b714fe6d21928e.tar.gz
libayatana-indicator-2e66ca5c013f2f37fc274c9d02b714fe6d21928e.tar.bz2
libayatana-indicator-2e66ca5c013f2f37fc274c9d02b714fe6d21928e.zip
Watching when we do name switches
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-service-manager.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index f3a29d0..f58c148 100644
--- a/libindicator/indicator-service-manager.c
+++ b/libindicator/indicator-service-manager.c
@@ -536,8 +536,9 @@ service_proxy_name_changed (GDBusConnection * connection, const gchar * sender_n
{
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data);
- const gchar * new_name;
- g_variant_get(parameters, "(&s&s&s)", NULL, NULL, &new_name);
+ const gchar * new_name = NULL;
+ const gchar * prev_name = NULL;
+ g_variant_get(parameters, "(&s&s&s)", NULL, &prev_name, &new_name);
if (new_name == NULL || new_name[0] == 0) {
if (priv->connected) {
@@ -547,10 +548,27 @@ service_proxy_name_changed (GDBusConnection * connection, const gchar * sender_n
start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
} else {
+ /* If we weren't connected before, we are now. Let's tell the
+ world! */
if (!priv->connected) {
priv->connected = TRUE;
g_signal_emit(G_OBJECT(user_data), signals[CONNECTION_CHANGE], 0, TRUE, TRUE);
}
+
+ /* If the names are both valid, and they're not the same, it means that
+ we've actually changed. So we need to tell the new guy that we're
+ watching them */
+ if (new_name != NULL && prev_name != NULL && new_name[0] != 0 && prev_name != 0 && g_strcmp0(prev_name, new_name) != 0) {
+ /* Send watch */
+ g_dbus_proxy_call(priv->service_proxy,
+ "Watch",
+ NULL, /* params */
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ priv->watch_cancel,
+ watch_cb,
+ user_data);
+ }
}
return;