diff options
author | Milan Crha <mcrha@redhat.com> | 2009-01-12 22:49:16 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2009-01-12 22:49:16 +0800 |
commit | 1df00c7d517794881faefd45b3ae230a6b0d8204 (patch) | |
tree | d0467011443c4a929e682edddee997a202e6a6d9 /calendar/gui/dialogs | |
parent | 83cfa8202cec8ed81e4e836b2a09787941dc4c4d (diff) | |
download | gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar.gz gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar.bz2 gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar.lz gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar.xz gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.tar.zst gsoc2013-evolution-1df00c7d517794881faefd45b3ae230a6b0d8204.zip |
** Fix for bug #563364
2009-01-12 Milan Crha <mcrha@redhat.com>
** Fix for bug #563364
* gui/e-day-view-time-item.h: (EDayViewTimeItem):
* gui/e-day-view-time-item.c: (e_day_view_time_item_class_init),
(e_day_view_time_item_init), (e_day_view_time_item_finalize),
(e_day_view_time_item_get_column_width), (edvti_draw_zone),
(e_day_view_time_item_draw), (edvti_second_zone_changed_cb),
(edvti_on_select_zone), (edvti_on_set_zone),
(e_day_view_time_item_show_popup_menu):
Show two timezones in the day view's time column.
* gui/apps_evolution_calendar.schemas.in:
* gui/calendar-config-keys.h:
* gui/calendar-config.h:
* gui/calendar-config.c: (calendar_config_get_day_second_zones),
(calendar_config_free_day_second_zones),
(calendar_config_set_day_second_zone),
(calendar_config_get_day_second_zone),
(calendar_config_select_day_second_zone),
(calendar_config_add_notification_day_second_zone):
Access configuration for the second day time zone.
* gui/dialogs/cal-prefs-dialog.glade:
* gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog):
* gui/dialogs/cal-prefs-dialog.c: (update_day_second_zone_caption),
(on_set_day_second_zone), (on_select_day_second_zone),
(day_second_zone_clicked), (setup_changes), (show_config),
(calendar_prefs_dialog_construct):
Manage the second day zone in a Preferences dialog.
svn path=/trunk/; revision=37060
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 100 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.glade | 188 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.h | 1 |
3 files changed, 238 insertions, 51 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 8ba51259e5..38871c2f89 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -132,6 +132,101 @@ timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) } static void +update_day_second_zone_caption (CalendarPrefsDialog *prefs) +{ + char *location; + const char *caption; + icaltimezone *zone; + + g_return_if_fail (prefs != NULL); + + caption = _("None"); + + location = calendar_config_get_day_second_zone (); + if (location && *location) { + zone = icaltimezone_get_builtin_timezone (location); + if (zone && icaltimezone_get_display_name (zone)) { + caption = icaltimezone_get_display_name (zone); + } + } + g_free (location); + + gtk_button_set_label (GTK_BUTTON (prefs->day_second_zone), caption); +} + +static void +on_set_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs) +{ + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item))) + return; + + calendar_config_set_day_second_zone (g_object_get_data (G_OBJECT (item), "timezone")); + update_day_second_zone_caption (prefs); +} + +static void +on_select_day_second_zone (GtkWidget *item, CalendarPrefsDialog *prefs) +{ + g_return_if_fail (prefs != NULL); + + calendar_config_select_day_second_zone (); + update_day_second_zone_caption (prefs); +} + +static void +day_second_zone_clicked (GtkWidget *widget, CalendarPrefsDialog *prefs) +{ + GtkWidget *menu, *item; + GSList *group = NULL, *recent_zones, *s; + char *location; + icaltimezone *zone, *second_zone = NULL; + + menu = gtk_menu_new (); + + location = calendar_config_get_day_second_zone (); + if (location && *location) + second_zone = icaltimezone_get_builtin_timezone (location); + g_free (location); + + group = NULL; + item = gtk_radio_menu_item_new_with_label (group, _("None")); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + if (!second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + + recent_zones = calendar_config_get_day_second_zones (); + for (s = recent_zones; s != NULL; s = s->next) { + zone = icaltimezone_get_builtin_timezone (s->data); + if (!zone) + continue; + + item = gtk_radio_menu_item_new_with_label (group, icaltimezone_get_display_name (zone)); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); + /* both comes from builtin, thus no problem to compare pointers */ + if (zone == second_zone) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_object_set_data_full (G_OBJECT (item), "timezone", g_strdup (s->data), g_free); + g_signal_connect (item, "toggled", G_CALLBACK (on_set_day_second_zone), prefs); + } + calendar_config_free_day_second_zones (recent_zones); + + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + item = gtk_menu_item_new_with_label (_("Select...")); + g_signal_connect (item, "activate", G_CALLBACK (on_select_day_second_zone), prefs); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + gtk_widget_show_all (menu); + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); +} + +static void daylight_saving_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { gboolean set = gtk_toggle_button_get_active ((GtkToggleButton *) prefs->daylight_saving); @@ -373,6 +468,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_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); g_signal_connect (G_OBJECT (prefs->daylight_saving), "toggled", G_CALLBACK (daylight_saving_changed), prefs); g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); @@ -513,6 +609,9 @@ show_config (CalendarPrefsDialog *prefs) set = calendar_config_get_daylight_saving (); gtk_toggle_button_set_active ((GtkToggleButton *) prefs->daylight_saving, set); + /* Day's second zone */ + update_day_second_zone_caption (prefs); + /* Working Days. */ working_days = calendar_config_get_working_days (); mask = 1 << 0; @@ -637,6 +736,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) /* General tab */ prefs->timezone = glade_xml_get_widget (gui, "timezone"); + prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); prefs->daylight_saving = glade_xml_get_widget (gui, "daylight_cb"); for (i = 0; i < 7; i++) prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index d3003bdb6f..0282d17d4d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -6,7 +6,7 @@ <widget class="GtkWindow" id="window1"> <property name="visible">True</property> - <property name="title" translatable="no">window1</property> + <property name="title">window1</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> @@ -96,46 +96,37 @@ <child> <widget class="GtkTable" id="time"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">4</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="GtkLabel" id="timezone_label"> + <widget class="Custom" id="timezone"> <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> - <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">timezone</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="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">0</property> - <property name="right_attach">1</property> + <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="x_options">fill</property> - <property name="y_options"></property> + <property name="y_options">fill</property> </packing> </child> <child> - <widget class="GtkLabel" id="label11"> + <widget class="GtkLabel" id="timezone_label"> <property name="visible">True</property> - <property name="label" translatable="yes">Time format:</property> - <property name="use_underline">False</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> <property name="wrap">False</property> @@ -144,6 +135,7 @@ <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> @@ -152,30 +144,32 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</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="Custom" id="timezone"> + <widget class="GtkCheckButton" id="daylight_cb"> <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="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">0</property> - <property name="bottom_attach">1</property> - <property name="y_options">fill</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> </child> @@ -235,24 +229,116 @@ </child> <child> - <widget class="GtkCheckButton" id="daylight_cb"> + <widget class="GtkLabel" id="label11"> <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="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> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label63"> + <property name="visible">True</property> + <property name="label" translatable="yes">Se_cond 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> + <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">3</property> + <property name="bottom_attach">4</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">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> - <property name="y_options"></property> + <property name="y_options">fill</property> </packing> </child> </widget> @@ -348,7 +434,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="mnemonic_widget">week_start_day</property> + <property name="mnemonic_widget">week_start_day</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> @@ -405,7 +491,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="mnemonic_widget">start_of_day</property> + <property name="mnemonic_widget">start_of_day</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 815080ea06..24682a6cc7 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -44,6 +44,7 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *timezone; + GtkWidget *day_second_zone; GtkWidget *daylight_saving; GtkWidget *working_days[7]; GtkWidget *week_start_day; |