diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-03-28 16:08:05 -0700 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-03-28 16:08:05 -0700 |
commit | 5261e7f898e82ef03e5e8658253ae0c111d5870e (patch) | |
tree | 21e5481d4af5e96368e575ef8f516759d8ff7bc0 | |
parent | 7eb6ba328fafe16a46be831351e3aa04a1465cb3 (diff) | |
parent | 249fa0ac6c1394d314cb4e48ed8f12fb0144f00a (diff) | |
download | ayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.tar.gz ayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.tar.bz2 ayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.zip |
Import upstream version 0.3.93
-rw-r--r-- | ChangeLog | 36 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/datetime-prefs-locations.c | 62 | ||||
-rw-r--r-- | src/datetime-prefs.c | 31 | ||||
-rw-r--r-- | src/datetime-service.c | 2 |
6 files changed, 112 insertions, 41 deletions
@@ -1,5 +1,41 @@ # Generated by Makefile. Do not edit. +2012-03-28 Charles Kerr <charles.kerr@canonical.com> + + 0.3.93 + +2012-03-28 Charles Kerr <charles.kerr@canonical.com> + + on shutdown, free icaltimezone's builtin timezones. + +2012-03-27 Charles Kerr <charles.kerr@canonical.com> + + free icaltimezone's list of builtin timezones when shutting down + +2012-03-28 Charles Kerr <charles.kerr@canonical.com> + + ensure that our ntp_query_answered() and tz_query_answered() dbus callbacks are cancelled when the datetime prefs page is disposed + +2012-03-27 Charles Kerr <charles.kerr@canonical.com> + + cancel the ntp_query_answered() and tz_query_answered() callbacks when the prefs panel is disposed. + +2012-03-26 Charles Kerr <charles.kerr@canonical.com> + + merge lp:~charlesk/indicator-datetime/fix-location-leak to fix several memory leaks in datetime's preferences ui reported in lp bug #965533 + +2012-03-20 Charles Kerr <charles.kerr@canonical.com> + + fix more leaks related to getting strings from COL_NAME and COL_ZONE... these columns are of type G_TYPE_STRING, so we need to g_free() the copies that we pull from the model with gtk_tree_model_get()... + +2012-03-20 Charles Kerr <charles.kerr@canonical.com> + + improvements based on feedback from desrt + +2012-03-16 Charles Kerr <charles.kerr@canonical.com> + + fix memory leak when saving user-specified timezone locations + 2012-03-21 Charles Kerr <charles.kerr@canonical.com> 0.3.92 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.92. +# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.93. # # Report bugs to <http://bugs.launchpad.net/indicator-datetime>. # @@ -572,8 +572,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-datetime' PACKAGE_TARNAME='indicator-datetime' -PACKAGE_VERSION='0.3.92' -PACKAGE_STRING='indicator-datetime 0.3.92' +PACKAGE_VERSION='0.3.93' +PACKAGE_STRING='indicator-datetime 0.3.93' PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-datetime' PACKAGE_URL='http://launchpad.net/indicator-datetime' @@ -1395,7 +1395,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.3.92 to adapt to many kinds of systems. +\`configure' configures indicator-datetime 0.3.93 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1466,7 +1466,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-datetime 0.3.92:";; + short | recursive ) echo "Configuration of indicator-datetime 0.3.93:";; esac cat <<\_ACEOF @@ -1600,7 +1600,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-datetime configure 0.3.92 +indicator-datetime configure 0.3.93 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1971,7 +1971,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.3.92, which was +It was created by indicator-datetime $as_me 0.3.93, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2795,7 +2795,7 @@ fi # Define the identity of the package. PACKAGE='indicator-datetime' - VERSION='0.3.92' + VERSION='0.3.93' cat >>confdefs.h <<_ACEOF @@ -15043,7 +15043,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.3.92, which was +This file was extended by indicator-datetime $as_me 0.3.93, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15110,7 +15110,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.3.92 +indicator-datetime config.status 0.3.93 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 6377b9a..0bd8b89 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-datetime], - [0.3.92], + [0.3.93], [http://bugs.launchpad.net/indicator-datetime], [indicator-datetime], [http://launchpad.net/indicator-datetime]) diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c index 9c71f8e..c0452d0 100644 --- a/src/datetime-prefs-locations.c +++ b/src/datetime-prefs-locations.c @@ -164,9 +164,10 @@ handle_edit (GtkCellRendererText * renderer, gchar * path, gchar * new_text, // edit), so we set the error icon here if needed. Common way to get to // this code path is to lose entry focus. if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store), &iter, path)) { - const gchar * name; + gchar * name; gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_NAME, &name, -1); gboolean correct = g_strcmp0 (name, new_text) == 0; + g_free (name); gtk_list_store_set (store, &iter, COL_VISIBLE_NAME, new_text, @@ -179,32 +180,36 @@ static gboolean timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, GtkTreeIter * iter, GtkWidget * dlg) { - const gchar * zone, * name; + gchar * zone = NULL; + gchar * name = NULL; gtk_tree_model_get (model, iter, CC_TIMEZONE_COMPLETION_ZONE, &zone, CC_TIMEZONE_COMPLETION_NAME, &name, -1); - if (zone == NULL || zone[0] == 0) { - const gchar * strlon, * strlat; - gdouble lon = 0.0, lat = 0.0; + /* if no explicit timezone, try to determine one from latlon */ + if (!zone || !*zone) + { + gchar * strlat = NULL; + gchar * strlon = NULL; + gdouble lat = 0; + gdouble lon = 0; gtk_tree_model_get (model, iter, - CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon, CC_TIMEZONE_COMPLETION_LATITUDE, &strlat, + CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon, -1); - if (strlon != NULL && strlon[0] != 0) { - lon = strtod(strlon, NULL); - } - - if (strlat != NULL && strlat[0] != 0) { - lat = strtod(strlat, NULL); - } + if (strlat && *strlat) lat = atof(strlat); + if (strlon && *strlon) lon = atof(strlon); CcTimezoneMap * tzmap = CC_TIMEZONE_MAP (g_object_get_data (G_OBJECT (widget), "tzmap")); - zone = cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat); + g_free (zone); + zone = g_strdup (cc_timezone_map_get_timezone_at_coords (tzmap, lon, lat)); + + g_free (strlat); + g_free (strlon); } GtkListStore * store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (widget), "store")); @@ -219,6 +224,10 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, update_times (dlg); + /* cleanup */ + g_free (name); + g_free (zone); + return FALSE; // Do normal action too } @@ -280,11 +289,11 @@ update_times (GtkWidget * dlg) GtkTreeIter iter; if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { do { - const gchar * strzone; + gchar * strzone; gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_ZONE, &strzone, -1); - if (strzone != NULL && strzone[0] != 0) { + if (strzone && *strzone) { GTimeZone * tz = g_time_zone_new (strzone); GDateTime * now_tz = g_date_time_to_timezone (now, tz); gchar * format = generate_format_string_at_time (now_tz); @@ -297,6 +306,7 @@ update_times (GtkWidget * dlg) g_date_time_unref (now_tz); g_time_zone_unref (tz); } + g_free (strzone); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); } @@ -343,21 +353,23 @@ save_to_settings (GObject * store, GSettings * conf) GtkTreeIter iter; if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { + GString * gstr = g_string_new (NULL); do { - const gchar * strzone, * strname; - + gchar * strname; + gchar * strzone; gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, COL_NAME, &strname, COL_ZONE, &strzone, -1); - - if (strzone != NULL && strzone[0] != 0 && strname != NULL && strname[0] != 0) { - gchar * settings_string = g_strdup_printf("%s %s", strzone, strname); - g_variant_builder_add (&builder, "s", settings_string); - g_free (settings_string); + if (strzone && *strzone && strname && *strname) { + g_string_printf (gstr, "%s %s", strzone, strname); + g_variant_builder_add (&builder, "s", gstr->str); empty = FALSE; } + g_free (strname); + g_free (strzone); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter)); + g_string_free (gstr, TRUE); } if (empty) { @@ -366,9 +378,7 @@ save_to_settings (GObject * store, GSettings * conf) g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, NULL); } else { - GVariant * locations = g_variant_builder_end (&builder); - g_settings_set_strv (conf, SETTINGS_LOCATIONS_S, g_variant_get_strv (locations, NULL)); - g_variant_unref (locations); + g_settings_set_value (conf, SETTINGS_LOCATIONS_S, g_variant_builder_end (&builder)); } } diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index bfe75c0..fbb8ea1 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -70,6 +70,8 @@ struct _IndicatorDatetimePanelPrivate gboolean changing_time; GtkWidget * loc_dlg; CcTimezoneCompletion * completion; + GCancellable * tz_query_cancel; + GCancellable * ntp_query_cancel; }; struct _IndicatorDatetimePanelClass @@ -214,6 +216,8 @@ ntp_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * GError * error = NULL; GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); + g_clear_object (&self->priv->ntp_query_cancel); + if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); g_error_free(error); @@ -265,6 +269,8 @@ tz_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * GError * error = NULL; GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); + g_clear_object (&self->priv->tz_query_cancel); + if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); g_error_free(error); @@ -286,6 +292,7 @@ static void proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) { GError * error = NULL; + IndicatorDatetimePanelPrivate * priv = self->priv; self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error); @@ -296,10 +303,16 @@ proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) } /* And now, do initial proxy configuration */ - g_dbus_proxy_call (self->priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, (GAsyncReadyCallback)ntp_query_answered, self); - g_dbus_proxy_call (self->priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, (GAsyncReadyCallback)tz_query_answered, self); + if (priv->ntp_query_cancel == NULL) { + priv->ntp_query_cancel = g_cancellable_new(); + g_dbus_proxy_call (priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + priv->ntp_query_cancel, (GAsyncReadyCallback)ntp_query_answered, self); + } + if (priv->tz_query_cancel == NULL); { + priv->tz_query_cancel = g_cancellable_new(); + g_dbus_proxy_call (priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + priv->tz_query_cancel, (GAsyncReadyCallback)tz_query_answered, self); + } } static void @@ -784,6 +797,16 @@ indicator_datetime_panel_dispose (GObject * object) g_clear_object (&priv->builder); g_clear_object (&priv->proxy); + if (priv->tz_query_cancel != NULL) { + g_cancellable_cancel (priv->tz_query_cancel); + g_clear_object (&priv->tz_query_cancel); + } + + if (priv->ntp_query_cancel != NULL) { + g_cancellable_cancel (priv->ntp_query_cancel); + g_clear_object (&priv->ntp_query_cancel); + } + if (priv->loc_dlg) { gtk_widget_destroy (priv->loc_dlg); priv->loc_dlg = NULL; diff --git a/src/datetime-service.c b/src/datetime-service.c index a10cbb5..fb95928 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -1479,6 +1479,8 @@ main (int argc, char ** argv) g_object_unref(G_OBJECT(server)); g_object_unref(G_OBJECT(root)); + icaltimezone_free_builtin_timezones(); + geo_address_clean(); geo_client_clean(); |