~evgeni/libindicator/link-libm

« back to all changes in this revision

Viewing changes to libindicator/indicator-service.c

  • Committer: Ted Gould
  • Date: 2011-07-14 18:08:31 UTC
  • mfrom: (422.2.2 test-fixes)
  • Revision ID: ted@gould.cx-20110714180831-1lfl6pgelxzjxna7
Fixing the libindicator test suite

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "dbus-shared.h"
33
33
 
34
34
static void unwatch_core (IndicatorService * service, const gchar * name);
35
 
static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_data);
 
35
static void watchers_remove (gpointer value);
36
36
static void bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data);
37
37
static GVariant * bus_watch (IndicatorService * service, const gchar * sender);
38
38
 
211
211
        }
212
212
 
213
213
        /* NOTE: We're using g_free here because that's what needs to
214
 
           happen, but you really should call watchers_remove first as well
215
 
           since that disconnects the signals.  We can't do that with a callback
216
 
           here because there is no user data to pass the object as well. */
217
 
        priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
 
214
           happen and we're watchers_remove as well to clean up the dbus
 
215
           watches we've setup. */
 
216
        priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, watchers_remove);
218
217
 
219
218
        priv->bus_cancel = g_cancellable_new();
220
219
        g_bus_get(G_BUS_TYPE_SESSION,
233
232
        IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object);
234
233
 
235
234
        if (priv->watchers != NULL) {
236
 
                g_hash_table_foreach_remove(priv->watchers, watchers_remove, object);
 
235
                g_hash_table_destroy(priv->watchers);
 
236
                priv->watchers = NULL;
237
237
        }
238
238
 
239
239
        if (priv->timeout != 0) {
417
417
 
418
418
/* A function to remove the signals on a proxy before we destroy
419
419
   it because in this case we've stopped caring. */
420
 
static gboolean
421
 
watchers_remove (gpointer key, gpointer value, gpointer user_data)
 
420
static void
 
421
watchers_remove (gpointer value)
422
422
{
423
423
        g_bus_unwatch_name(GPOINTER_TO_UINT(value));
424
 
        return TRUE;
 
424
        return;
425
425
}
426
426
 
427
427
/* This is the function that gets executed if we timeout
588
588
        /* Remove us from the watcher list here */
589
589
        gpointer watcher_item = g_hash_table_lookup(priv->watchers, name);
590
590
        if (watcher_item != NULL) {
591
 
                /* Free the watcher */
592
 
                watchers_remove((gpointer)name, watcher_item, service);
593
591
                g_hash_table_remove(priv->watchers, name);
594
592
        } else {
595
593
                /* Odd that we couldn't find the person, but, eh */