[evolution/wip/gsettings] Bug #659932 - 'Use system time zone' in not honored immediately



commit 959921759213d931f0bfd0c29ce8274f3fb88f8a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 26 11:20:35 2011 +0200

    Bug #659932 - 'Use system time zone' in not honored immediately

 calendar/gui/e-cal-model.c              |    2 ++
 modules/calendar/e-cal-shell-settings.c |   31 ++++++++++++++++++++++++++++---
 2 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index a609ec8..f177913 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -137,6 +137,7 @@ static ECalModelClient *add_new_client (ECalModel *model, ECalClient *client, gb
 static ECalModelClient *find_client_data (ECalModel *model, ECalClient *client);
 static void remove_client_objects (ECalModel *model, ECalModelClient *client_data);
 static void remove_client (ECalModel *model, ECalModelClient *client_data);
+static void redo_queries (ECalModel *model);
 
 enum {
 	PROP_0,
@@ -1733,6 +1734,7 @@ e_cal_model_set_timezone (ECalModel *model,
 	/* the timezone affects the times shown for date fields,
 	 * so we need to redisplay everything */
 	e_table_model_changed (E_TABLE_MODEL (model));
+	redo_queries (model);
 
 	g_object_notify (G_OBJECT (model), "timezone");
 	g_signal_emit (G_OBJECT (model), signals[TIMEZONE_CHANGED], 0,
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 4d105bc..456f957 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -69,19 +69,34 @@ transform_icaltimezone_to_string (GBinding *binding,
                                   GValue *target_value,
                                   gpointer user_data)
 {
+	EShellSettings *shell_settings;
+	gboolean use_system_timezone;
 	const gchar *location = NULL;
+	gchar *location_str = NULL;
 	icaltimezone *timezone;
 
-	timezone = g_value_get_pointer (source_value);
+	shell_settings = E_SHELL_SETTINGS (user_data);
 
-	if (timezone != NULL)
-		location = icaltimezone_get_location (timezone);
+	use_system_timezone = e_shell_settings_get_boolean (
+		shell_settings, "cal-use-system-timezone");
+
+	if (use_system_timezone) {
+		location_str = e_shell_settings_get_string (shell_settings, "cal-timezone-string");
+		location = location_str;
+	} else {
+		timezone = g_value_get_pointer (source_value);
+
+		if (timezone != NULL)
+			location = icaltimezone_get_location (timezone);
+	}
 
 	if (location == NULL)
 		location = "UTC";
 
 	g_value_set_string (target_value, location);
 
+	g_free (location_str);
+
 	return TRUE;
 }
 
@@ -494,6 +509,12 @@ transform_working_days_saturday_to_bitset (GBinding *binding,
 	return TRUE;
 }
 
+static void
+cal_use_system_timezone_changed_cb (GObject *shell_settings)
+{
+	g_object_notify (shell_settings, "cal-timezone-string");
+}
+
 void
 e_cal_shell_backend_init_settings (EShell *shell)
 {
@@ -872,4 +893,8 @@ e_cal_shell_backend_init_settings (EShell *shell)
 		transform_working_days_saturday_to_bitset,
 		g_object_ref (shell_settings),
 		(GDestroyNotify) g_object_unref);
+
+	g_signal_connect (
+		shell_settings, "notify::cal-use-system-timezone",
+		G_CALLBACK (cal_use_system_timezone_changed_cb), NULL);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]