diff options
author | Ted Gould <ted@gould.cx> | 2010-07-09 13:13:21 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-07-09 13:13:21 -0500 |
commit | c7eee08171b40c224564a5fffd3a4c5f0e32f7c9 (patch) | |
tree | 7349c03c59c6e712047a3867ef01cd3f272ac59d | |
parent | ed191e6c58df840aec26d068e2b206dc15264459 (diff) | |
download | libayatana-indicator-c7eee08171b40c224564a5fffd3a4c5f0e32f7c9.tar.gz libayatana-indicator-c7eee08171b40c224564a5fffd3a4c5f0e32f7c9.tar.bz2 libayatana-indicator-c7eee08171b40c224564a5fffd3a4c5f0e32f7c9.zip |
We want the key not the value.
-rw-r--r-- | libindicator/indicator-service.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index d0f8ed2..55fb650 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -395,12 +395,20 @@ 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) { - if (value == user_data) { + hash_table_find_t * finddata = (hash_table_find_t *)user_data; + if (value == finddata->proxy) { + finddata->name = key; return TRUE; } return FALSE; @@ -414,8 +422,11 @@ proxy_destroyed (GObject * proxy, gpointer user_data) g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data); - gchar * name = (gchar *)g_hash_table_find(priv->watchers, hash_table_find, 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; } |