diff options
author | Ted Gould <ted@gould.cx> | 2011-02-03 15:09:26 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-03 15:09:26 -0600 |
commit | 82d679de373936e24e2aa62be8c317dd2b3f2523 (patch) | |
tree | 9c4c545edf167ea0e726bfd78c7767d4a003b44c | |
parent | 28f84ee512a35e2b04b211b7c1705a6eef4368ab (diff) | |
parent | cc86c810a971fe53dd34e96bb985e3a4a1cb4211 (diff) | |
download | ayatana-indicator-datetime-82d679de373936e24e2aa62be8c317dd2b3f2523.tar.gz ayatana-indicator-datetime-82d679de373936e24e2aa62be8c317dd2b3f2523.tar.bz2 ayatana-indicator-datetime-82d679de373936e24e2aa62be8c317dd2b3f2523.zip |
Import upstream version 0.1.92
-rw-r--r-- | ChangeLog | 40 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/datetime-service.c | 66 | ||||
-rw-r--r-- | src/indicator-datetime.c | 2 |
5 files changed, 111 insertions, 21 deletions
@@ -1,5 +1,45 @@ # Generated by Makefile. Do not edit. +2011-02-03 Ted Gould <ted@gould.cx> + + 0.1.92 + +2011-02-01 Ted Gould <ted@gould.cx> + + Try to be better at cleaning up geoclue objects. + +2011-02-01 Ted Gould <ted@gould.cx> + + Forgot to bring up the prototypes. + +2011-02-01 Ted Gould <ted@gould.cx> + + Putting the clear functions in shutdown so the objects get cleaned up nicely there as well. + +2011-02-01 Ted Gould <ted@gould.cx> + + Changing the clean up of the client to be in a function and drop the signals as well. + +2011-02-01 Ted Gould <ted@gould.cx> + + Put the geo_address clean up in a small helper function. + +2011-02-01 Ted Gould <ted@gould.cx> + + Adding more comments + +2011-01-31 Ted Gould <ted@gould.cx> + + Make sure to clear the address when clients change. + +2011-02-01 Ted Gould <ted@gould.cx> + + Changing a g_error to a g_warning in the .so + +2011-01-31 Ted Gould <ted@gould.cx> + + Make no proxy a warning + 2011-01-27 Ted Gould <ted@gould.cx> 0.1.91 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.91. +# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.92. # # Report bugs to <ted@canonical.com>. # @@ -703,8 +703,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-datetime' PACKAGE_TARNAME='indicator-datetime' -PACKAGE_VERSION='0.1.91' -PACKAGE_STRING='indicator-datetime 0.1.91' +PACKAGE_VERSION='0.1.92' +PACKAGE_STRING='indicator-datetime 0.1.92' PACKAGE_BUGREPORT='ted@canonical.com' PACKAGE_URL='' @@ -1493,7 +1493,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-datetime 0.1.91 to adapt to many kinds of systems. +\`configure' configures indicator-datetime 0.1.92 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1564,7 +1564,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-datetime 0.1.91:";; + short | recursive ) echo "Configuration of indicator-datetime 0.1.92:";; esac cat <<\_ACEOF @@ -1687,7 +1687,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-datetime configure 0.1.91 +indicator-datetime configure 0.1.92 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2058,7 +2058,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-datetime $as_me 0.1.91, which was +It was created by indicator-datetime $as_me 0.1.92, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2879,7 +2879,7 @@ fi # Define the identity of the package. PACKAGE=indicator-datetime - VERSION=0.1.91 + VERSION=0.1.92 cat >>confdefs.h <<_ACEOF @@ -14158,7 +14158,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-datetime $as_me 0.1.91, which was +This file was extended by indicator-datetime $as_me 0.1.92, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14224,7 +14224,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-datetime config.status 0.1.91 +indicator-datetime config.status 0.1.92 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 9118db8..c5e7012 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-datetime, 0.1.91, ted@canonical.com) +AC_INIT(indicator-datetime, 0.1.92, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-datetime, 0.1.91) +AM_INIT_AUTOMAKE(indicator-datetime, 0.1.92) AM_MAINTAINER_MODE diff --git a/src/datetime-service.c b/src/datetime-service.c index 8a31940..9f795d1 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -40,6 +40,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static void geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * path, GError * error, gpointer user_data); static void setup_timer (void); +static void geo_client_invalid (GeoclueMasterClient * client, gpointer user_data); +static void geo_address_change (GeoclueMasterClient * client, gchar * a, gchar * b, gchar * c, gchar * d, gpointer user_data); static IndicatorService * service = NULL; static GMainLoop * mainloop = NULL; @@ -384,6 +386,41 @@ geo_address_cb (GeoclueAddress * address, int timestamp, GHashTable * addy_data, return; } +/* Clean up the reference we kept to the address and make sure to + drop the signals incase someone else has one. */ +static void +geo_address_clean (void) +{ + if (geo_address == NULL) { + return; + } + + g_signal_handlers_disconnect_by_func(G_OBJECT(geo_address), geo_address_cb, NULL); + g_object_unref(G_OBJECT(geo_address)); + + geo_address = NULL; + + 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) @@ -393,6 +430,12 @@ geo_create_address (GeoclueMasterClient * master, GeoclueAddress * address, GErr return; } + /* We shouldn't have created a new address if we already had one + so this is a warning. But, it really is only a mem-leak so we + don't need to error out. */ + g_warn_if_fail(geo_address == NULL); + geo_address_clean(); + g_debug("Created Geoclue Address"); geo_address = address; g_object_ref(G_OBJECT(geo_address)); @@ -420,10 +463,12 @@ geo_client_invalid (GeoclueMasterClient * client, gpointer user_data) { g_warning("Master client invalid, rebuilding."); - if (geo_master != NULL) { - g_object_unref(G_OBJECT(geo_master)); - } - geo_master = NULL; + /* Client changes we can assume the address is now invalid so we + need to unreference the one we had. */ + geo_address_clean(); + + /* And our master client is invalid */ + geo_client_clean(); GeoclueMaster * master = geoclue_master_get_default(); geoclue_master_create_client_async(master, geo_create_client, NULL); @@ -444,10 +489,9 @@ geo_address_change (GeoclueMasterClient * client, gchar * a, gchar * b, gchar * { g_warning("Address provider changed. Let's change"); - if (geo_address != NULL) { - g_object_unref(G_OBJECT(geo_address)); - } - geo_address = NULL; + /* If the address is supposed to have changed we need to drop the old + address before starting to get the new one. */ + geo_address_clean(); geoclue_master_client_create_address_async(geo_master, geo_create_address, NULL); @@ -470,6 +514,9 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * geo_master = client; g_object_ref(G_OBJECT(geo_master)); + /* New client, make sure we don't have an address hanging on */ + geo_address_clean(); + geoclue_master_client_set_requirements_async(geo_master, GEOCLUE_ACCURACY_LEVEL_REGION, 0, @@ -537,6 +584,9 @@ main (int argc, char ** argv) mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + geo_address_clean(); + geo_client_clean(); + g_object_unref(G_OBJECT(master)); g_object_unref(G_OBJECT(dbus)); g_object_unref(G_OBJECT(service)); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index c386300..521c9e9 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -330,7 +330,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) } if (error != NULL) { - g_error("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message); + g_warning("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message); g_error_free(error); return; } |