diff options
author | Ted Gould <ted@gould.cx> | 2011-02-01 09:48:29 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-01 09:48:29 -0600 |
commit | 5de989fb1e270fbc9381b432e49df6790f985258 (patch) | |
tree | 1552c7709b263c3dfd1274784ccbdca198c39003 /src | |
parent | 96ab5fe4d0dc4d8221e05116f6babcaf66cf2379 (diff) | |
download | ayatana-indicator-datetime-5de989fb1e270fbc9381b432e49df6790f985258.tar.gz ayatana-indicator-datetime-5de989fb1e270fbc9381b432e49df6790f985258.tar.bz2 ayatana-indicator-datetime-5de989fb1e270fbc9381b432e49df6790f985258.zip |
Changing the clean up of the client to be in a function and drop the signals as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-service.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index 2a9ccdb..59308dd 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -401,6 +401,24 @@ geo_address_clean (void) return; } +/* Clean up and remove all signal handlers from the client as we + unreference it as well. */ +static void +geo_client_clean (void) +{ + if (geo_master == NULL) { + return; + } + + g_signal_handlers_disconnect_by_func(G_OBJECT(geo_master), geo_client_invalid, NULL); + g_signal_handlers_disconnect_by_func(G_OBJECT(geo_master), geo_address_change, NULL); + g_object_unref(G_OBJECT(geo_master)); + + geo_master = NULL; + + return; +} + /* Callback from creating the address */ static void geo_create_address (GeoclueMasterClient * master, GeoclueAddress * address, GError * error, gpointer user_data) @@ -448,10 +466,7 @@ geo_client_invalid (GeoclueMasterClient * client, gpointer user_data) geo_address_clean(); /* And our master client is invalid */ - if (geo_master != NULL) { - g_object_unref(G_OBJECT(geo_master)); - } - geo_master = NULL; + geo_client_clean(); GeoclueMaster * master = geoclue_master_get_default(); geoclue_master_create_client_async(master, geo_create_client, NULL); |