aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-04-25 01:11:03 +0800
committerMilan Crha <mcrha@redhat.com>2009-04-25 01:11:03 +0800
commitc33335bc72d9db97248ea5c5dc6da9cbfdb16e2c (patch)
tree4d447c8f1a02d8bc9021f6bbf1c1bf63d74fbb9e /calendar/gui/dialogs
parentf171b15d926480a4199d74f14356b7aa37b16f20 (diff)
downloadgsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.gz
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.bz2
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.lz
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.xz
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.zst
gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.zip
Use system timezone in Evolution
** Fix for bug #381132
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c34
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade206
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h2
3 files changed, 190 insertions, 52 deletions
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
@@ -480,6 +480,30 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs)
}
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)
{
int i;
@@ -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 @@
<child>
<widget class="GtkTable" id="time">
<property name="visible">True</property>
- <property name="n_rows">4</property>
+ <property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
- <widget class="Custom" id="timezone">
+ <widget class="GtkLabel" id="label63">
<property name="visible">True</property>
- <property name="creation_function">make_timezone_entry</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 13 Jan 2005 04:18:03 GMT</property>
- <accessibility>
- <atkrelation target="timezone_label" type="labelled-by"/>
- </accessibility>
+ <property name="label" translatable="yes">Se_cond zone:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">day_second_zone</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox25">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="day_second_zone">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">None</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label64">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">(Shown in a Day View)</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">6</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="timezone_label">
+ <widget class="GtkLabel" id="label11">
<property name="visible">True</property>
- <property name="label" translatable="yes">Time _zone:</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Time format:</property>
+ <property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@@ -135,7 +201,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">timezone</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -144,8 +209,30 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="daylight_cb">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Adjust for daylight sa_ving time</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@@ -199,34 +286,28 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label11">
+ <widget class="GtkCheckButton" id="daylight_cb">
<property name="visible">True</property>
- <property name="label" translatable="yes">Time format:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Adjust for daylight sa_ving time</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
@@ -235,9 +316,29 @@
</child>
<child>
- <widget class="GtkLabel" id="label63">
+ <widget class="Custom" id="timezone">
<property name="visible">True</property>
- <property name="label" translatable="yes">Se_cond zone:</property>
+ <property name="creation_function">make_timezone_entry</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Thu, 13 Jan 2005 04:18:03 GMT</property>
+ <accessibility>
+ <atkrelation target="timezone_label" type="labelled-by"/>
+ </accessibility>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="timezone_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Time _zone:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -247,7 +348,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">day_second_zone</property>
+ <property name="mnemonic_widget">timezone</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -256,39 +357,42 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox25">
+ <widget class="GtkHBox" id="hbox26">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkButton" id="day_second_zone">
+ <widget class="GtkCheckButton" id="use-system-tz-check">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">None</property>
+ <property name="label" translatable="yes">Use s_ystem time zone</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label64">
+ <widget class="GtkLabel" id="system-tz-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">(Shown in a Day View)</property>
+ <property name="label">(system/tz)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -296,7 +400,7 @@
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
- <property name="xpad">6</property>
+ <property name="xpad">5</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
@@ -313,10 +417,9 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
<property name="x_options">fill</property>
- <property name="y_options">fill</property>
</packing>
</child>
</widget>
@@ -1246,6 +1349,7 @@ Days</property>
<property name="fill">False</property>
</packing>
</child>
+
<child>
<widget class="GtkCheckButton" id="dview_show_week_no">
<property name="visible">True</property>
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];