aboutsummaryrefslogtreecommitdiff
path: root/libindicator/indicator-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-09 13:35:55 -0500
committerTed Gould <ted@gould.cx>2010-07-09 13:35:55 -0500
commit17a29ea22b98302ab3a70861499ee6f4f49e964f (patch)
tree7349c03c59c6e712047a3867ef01cd3f272ac59d /libindicator/indicator-service.c
parentbc5e925ed181f2b64229afcac41bb4ba4f9aa4d1 (diff)
parentc7eee08171b40c224564a5fffd3a4c5f0e32f7c9 (diff)
downloadlibayatana-indicator-17a29ea22b98302ab3a70861499ee6f4f49e964f.tar.gz
libayatana-indicator-17a29ea22b98302ab3a70861499ee6f4f49e964f.tar.bz2
libayatana-indicator-17a29ea22b98302ab3a70861499ee6f4f49e964f.zip
Fixing unwatching lookups.
Diffstat (limited to 'libindicator/indicator-service.c')
-rw-r--r--libindicator/indicator-service.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index db234e2..55fb650 100644
--- a/libindicator/indicator-service.c
+++ b/libindicator/indicator-service.c
@@ -395,15 +395,38 @@ try_and_get_name (IndicatorService * service)
return;
}
+typedef struct _hash_table_find_t hash_table_find_t;
+struct _hash_table_find_t {
+ GObject * proxy;
+ gchar * name;
+};
+
+/* Look in the hash table for the proxy, as it won't give us
+ its name. */
+static gboolean
+hash_table_find (gpointer key, gpointer value, gpointer user_data)
+{
+ hash_table_find_t * finddata = (hash_table_find_t *)user_data;
+ if (value == finddata->proxy) {
+ finddata->name = key;
+ return TRUE;
+ }
+ return FALSE;
+}
+
/* If the proxy gets destroyed that's the same as getting an
unwatch signal. Make it so. */
static void
proxy_destroyed (GObject * proxy, gpointer user_data)
{
g_return_if_fail(INDICATOR_IS_SERVICE(user_data));
+ IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data);
- const gchar * name = dbus_g_proxy_get_bus_name(DBUS_G_PROXY(proxy));
- unwatch_core(INDICATOR_SERVICE(user_data), name);
+ hash_table_find_t finddata = {0};
+ finddata.proxy = proxy;
+
+ g_hash_table_find(priv->watchers, hash_table_find, &finddata);
+ unwatch_core(INDICATOR_SERVICE(user_data), finddata.name);
return;
}
@@ -466,6 +489,9 @@ _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvoc
static void
unwatch_core (IndicatorService * service, const gchar * name)
{
+ g_return_if_fail(name != NULL);
+ g_return_if_fail(INDICATOR_IS_SERVICE(service));
+
IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service);
/* Remove us from the watcher list here */