aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-prefs.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-28 16:08:05 -0700
committerCharles Kerr <charles.kerr@canonical.com>2012-03-28 16:08:05 -0700
commit5261e7f898e82ef03e5e8658253ae0c111d5870e (patch)
tree21e5481d4af5e96368e575ef8f516759d8ff7bc0 /src/datetime-prefs.c
parent7eb6ba328fafe16a46be831351e3aa04a1465cb3 (diff)
parent249fa0ac6c1394d314cb4e48ed8f12fb0144f00a (diff)
downloadayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.tar.gz
ayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.tar.bz2
ayatana-indicator-datetime-5261e7f898e82ef03e5e8658253ae0c111d5870e.zip
Import upstream version 0.3.93
Diffstat (limited to 'src/datetime-prefs.c')
-rw-r--r--src/datetime-prefs.c31
1 files changed, 27 insertions, 4 deletions
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;