[evolution] Bug 617094 - System timezone label not initialized in preferences



commit 740c2caaf80265a070a6660448b29f2a40eb47b2
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun May 30 00:16:04 2010 -0400

    Bug 617094 - System timezone label not initialized in preferences
    
    Gert Kulyk gets credit for solving the bug, I just refactored the code a
    bit more heavily.

 calendar/gui/dialogs/cal-prefs-dialog.c |   23 +++++++++++++++--------
 calendar/gui/dialogs/cal-prefs-dialog.h |    1 -
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index f2693d5..410f8cb 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -397,16 +397,23 @@ update_system_tz_widgets (EShellSettings *shell_settings,
                           GParamSpec *pspec,
                           CalendarPrefsDialog *prefs)
 {
+	GtkWidget *widget;
 	icaltimezone *zone;
+	const gchar *display_name;
+	gchar *text;
+
+	widget = e_builder_get_widget (prefs->builder, "system-tz-label");
+	g_return_if_fail (GTK_IS_LABEL (widget));
 
 	zone = e_cal_util_get_system_timezone ();
-	if (zone) {
-		gchar *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)");
-	}
+	if (zone != NULL)
+		display_name = gettext (icaltimezone_get_display_name (zone));
+	else
+		display_name = "UTC";
+
+	text = g_strdup_printf ("(%s)", display_name);
+	gtk_label_set_text (GTK_LABEL (widget), text);
+	g_free (text);
 }
 
 static void
@@ -636,6 +643,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
 	g_signal_connect (
 		shell_settings, "notify::cal-use-system-timezone",
 		G_CALLBACK (update_system_tz_widgets), prefs);
+	g_object_notify (G_OBJECT (shell_settings), "cal-use-system-timezone");
 
 	widget = e_builder_get_widget (prefs->builder, "timezone");
 	e_mutual_binding_new (
@@ -646,7 +654,6 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
 		widget, "sensitive");
 
 	/* General tab */
-	prefs->system_tz_label = e_builder_get_widget (prefs->builder, "system-tz-label");
 	prefs->day_second_zone = e_builder_get_widget (prefs->builder, "day_second_zone");
 
 	widget = e_builder_get_widget (prefs->builder, "sun_button");
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 1ae585a..e01399f 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -61,7 +61,6 @@ struct _CalendarPrefsDialog {
 	GConfClient *gconf;
 
 	/* General tab */
-	GtkWidget *system_tz_label;
 	GtkWidget *day_second_zone;
 	GtkWidget *working_days[7];
 	GtkWidget *week_start_day;



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