From c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 19:11:03 +0200 Subject: Use system timezone in Evolution ** Fix for bug #381132 --- calendar/gui/dialogs/cal-prefs-dialog.c | 34 ++++- calendar/gui/dialogs/cal-prefs-dialog.glade | 206 +++++++++++++++++++++------- calendar/gui/dialogs/cal-prefs-dialog.h | 2 + 3 files changed, 190 insertions(+), 52 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index edb802fd10..60678d93e1 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -479,6 +479,30 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) calendar_config_set_free_busy_template (gtk_entry_get_text (entry)); } +static void +update_system_tz_widgets (CalendarPrefsDialog *prefs) +{ + icaltimezone *zone; + + zone = e_cal_util_get_system_timezone (); + if (zone) { + char *tmp = g_strdup_printf ("(%s)", icaltimezone_get_display_name (zone)); + gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), tmp); + g_free (tmp); + } else { + gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), "(UTC)"); + } + + gtk_widget_set_sensitive (prefs->timezone, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check))); +} + +static void +use_system_tz_changed (GtkWidget *check, CalendarPrefsDialog *prefs) +{ + calendar_config_set_use_system_timezone (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); + update_system_tz_widgets (prefs); +} + static void setup_changes (CalendarPrefsDialog *prefs) { @@ -487,6 +511,7 @@ setup_changes (CalendarPrefsDialog *prefs) for (i = 0; i < 7; i ++) g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs); + g_signal_connect (G_OBJECT (prefs->use_system_tz_check), "toggled", G_CALLBACK (use_system_tz_changed), prefs); g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs); g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); @@ -620,8 +645,13 @@ show_config (CalendarPrefsDialog *prefs) CalUnits units; int interval; + /* Use system timezone */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check), calendar_config_get_use_system_timezone ()); + gtk_widget_set_sensitive (prefs->system_tz_label, FALSE); + update_system_tz_widgets (prefs); + /* Timezone. */ - location = calendar_config_get_timezone (); + location = calendar_config_get_timezone_stored (); zone = icaltimezone_get_builtin_timezone (location); e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone); g_free (location); @@ -762,6 +792,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); /* General tab */ + prefs->use_system_tz_check = glade_xml_get_widget (gui, "use-system-tz-check"); + prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label"); prefs->timezone = glade_xml_get_widget (gui, "timezone"); prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); for (i = 0; i < 7; i++) diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index 23406d5963..867abdbb22 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -96,37 +96,103 @@ True - 4 + 5 2 False 6 6 - + True - make_timezone_entry - 0 - 0 - Thu, 13 Jan 2005 04:18:03 GMT - - - + Se_cond zone: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + day_second_zone + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + False + 0 + + + + True + True + None + True + GTK_RELIEF_NORMAL + True + + + 0 + True + True + + + + + + True + (Shown in a Day View) + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 6 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + 1 2 - 0 - 1 + 4 + 5 + fill fill - + True - Time _zone: - True + Time format: + False False GTK_JUSTIFY_LEFT False @@ -135,7 +201,6 @@ 0.5 0 0 - timezone PANGO_ELLIPSIZE_NONE -1 False @@ -144,8 +209,30 @@ 0 1 - 0 - 1 + 3 + 4 + fill + + + + + + + True + True + Adjust for daylight sa_ving time + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 2 + 1 + 2 fill @@ -199,34 +286,28 @@ 1 2 - 2 - 3 + 3 + 4 fill fill - + True - Time format: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + True + Adjust for daylight sa_ving time + True + GTK_RELIEF_NORMAL + True + False + False + True - 0 - 1 + 1 + 2 2 3 fill @@ -235,9 +316,29 @@ - + True - Se_cond zone: + make_timezone_entry + 0 + 0 + Thu, 13 Jan 2005 04:18:03 GMT + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + Time _zone: True False GTK_JUSTIFY_LEFT @@ -247,7 +348,7 @@ 0.5 0 0 - day_second_zone + timezone PANGO_ELLIPSIZE_NONE -1 False @@ -256,39 +357,42 @@ 0 1 - 3 - 4 + 0 + 1 fill - + True False 0 - + True True - None + Use s_ystem time zone True GTK_RELIEF_NORMAL True + False + False + True 0 - True + False True - + True - (Shown in a Day View) + (system/tz) False False GTK_JUSTIFY_LEFT @@ -296,7 +400,7 @@ False 0.5 0.5 - 6 + 5 0 PANGO_ELLIPSIZE_NONE -1 @@ -313,10 +417,9 @@ 1 2 - 3 - 4 + 0 + 1 fill - fill @@ -1246,6 +1349,7 @@ Days False + True diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 945c1d6e16..559eacced7 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -43,6 +43,8 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ + GtkWidget *use_system_tz_check; + GtkWidget *system_tz_label; GtkWidget *timezone; GtkWidget *day_second_zone; GtkWidget *working_days[7]; -- cgit v1.2.3