diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/calendar/e-cal-shell-backend.c | 12 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-private.c | 24 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-private.h | 2 |
3 files changed, 35 insertions, 3 deletions
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 0a9c80fb3d..65f88022d8 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -666,7 +666,17 @@ static void cal_shell_backend_use_system_timezone_changed_cb (GSettings *settings, const gchar *key) { - g_signal_emit_by_name (settings, "changed::timezone", timezone); + /* the '-1' is a trick to emit the change the first time */ + static gint old_value = -1; + gboolean value; + + value = g_settings_get_boolean (settings, key); + + if ((value ? 1 : 0) != old_value) { + old_value = value ? 1 : 0; + + g_signal_emit_by_name (settings, "changed::timezone", timezone); + } } static void diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 863fd0136e..5a26284575 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -88,7 +88,21 @@ task_shell_view_hide_completed_tasks_changed_cb (GSettings *settings, const gchar *key, ETaskShellView *task_shell_view) { - task_shell_view_process_completed_tasks (task_shell_view); + GVariant *new_value, *old_value; + + new_value = g_settings_get_value (settings, key); + old_value = g_hash_table_lookup (task_shell_view->priv->old_settings, key); + + if (!new_value || !old_value || !g_variant_equal (new_value, old_value)) { + if (new_value) + g_hash_table_insert (task_shell_view->priv->old_settings, g_strdup (key), new_value); + else + g_hash_table_remove (task_shell_view->priv->old_settings, key); + + task_shell_view_process_completed_tasks (task_shell_view); + } else if (new_value) { + g_variant_unref (new_value); + } } static void @@ -210,6 +224,8 @@ task_shell_view_notify_view_id_cb (EShellView *shell_view) void e_task_shell_view_private_init (ETaskShellView *task_shell_view) { + task_shell_view->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); + e_signal_connect_notify ( task_shell_view, "notify::view-id", G_CALLBACK (task_shell_view_notify_view_id_cb), NULL); @@ -553,7 +569,11 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view) void e_task_shell_view_private_finalize (ETaskShellView *task_shell_view) { - /* XXX Nothing to do? */ + if (task_shell_view->priv->old_settings) { + g_hash_table_destroy (task_shell_view->priv->old_settings); + task_shell_view->priv->old_settings = NULL; + } + } void diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h index b2a1511c9a..d29bd2e771 100644 --- a/modules/calendar/e-task-shell-view-private.h +++ b/modules/calendar/e-task-shell-view-private.h @@ -120,6 +120,8 @@ struct _ETaskShellViewPrivate { guint update_completed_timeout; guint confirm_purge : 1; + + GHashTable *old_settings; }; void e_task_shell_view_private_init |