diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-08 09:43:09 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-09 09:03:18 +0800 |
commit | 3b0699fc304d0f4aecb261d19869de221f5d6abf (patch) | |
tree | eb434f85371c9d5ae75a8425fc622c31e08baa5b /calendar/gui/dialogs | |
parent | 65695ae516532a4b6e129a0703b1056a3996de0c (diff) | |
download | gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.gz gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.zst gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.zip |
More refactoring of settings management.
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 52 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 41 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/schedule-page.c | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 41 |
7 files changed, 81 insertions, 76 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 5c56d69007..8f22c98569 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -95,16 +95,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget } static void -timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - icaltimezone *zone; - - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone)); - - calendar_config_set_timezone (icaltimezone_get_location (zone)); -} - -static void update_day_second_zone_caption (CalendarPrefsDialog *prefs) { gchar *location; @@ -402,12 +392,6 @@ alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs) } static void -template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) -{ - calendar_config_set_free_busy_template (gtk_entry_get_text (entry)); -} - -static void update_system_tz_widgets (EShellSettings *shell_settings, GParamSpec *pspec, CalendarPrefsDialog *prefs) @@ -427,7 +411,6 @@ update_system_tz_widgets (EShellSettings *shell_settings, static void setup_changes (CalendarPrefsDialog *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->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); @@ -455,20 +438,6 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs); -} - -/* Shows the current Free/Busy settings in the dialog */ -static void -show_fb_config (CalendarPrefsDialog *prefs) -{ - gchar *template_url; - - template_url = calendar_config_get_free_busy_template (); - gtk_entry_set_text (GTK_ENTRY (prefs->template_url), (template_url ? template_url : "")); - - g_free (template_url); } /* Shows the current task list settings in the dialog */ @@ -538,16 +507,9 @@ show_config (CalendarPrefsDialog *prefs) gint mask, day, time_divisions; icaltimezone *zone; gboolean sensitive, set = FALSE; - gchar *location; CalUnits units; gint interval; - /* 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); - /* Day's second zone */ update_day_second_zone_caption (prefs); @@ -573,9 +535,6 @@ show_config (CalendarPrefsDialog *prefs) /* Alarms list*/ show_alarms_config (prefs); - /* Free/Busy */ - show_fb_config (prefs); - /* Other page */ e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ()); e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ()); @@ -662,13 +621,15 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, G_CALLBACK (update_system_tz_widgets), prefs); widget = glade_xml_get_widget (gui, "timezone"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (widget), "timezone"); e_mutual_binding_new_with_negation ( G_OBJECT (shell_settings), "cal-use-system-timezone", G_OBJECT (widget), "sensitive"); /* General tab */ 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"); widget = glade_xml_get_widget (gui, "sun_button"); @@ -764,7 +725,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, widget = glade_xml_get_widget (gui, "dnav_show_week_no"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (widget), "active"); widget = glade_xml_get_widget (gui, "dview_show_week_no"); @@ -799,7 +760,10 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window"); /* Free/Busy tab */ - prefs->template_url = glade_xml_get_widget (gui, "template_url"); + widget = glade_xml_get_widget (gui, "template_url"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (widget), "text"); target = e_cal_config_target_new_prefs (ec, prefs->gconf); e_config_set_target ((EConfig *)ec, (EConfigTarget *) target); toplevel = e_config_create_widget ((EConfig *)ec); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 5d0a3716a6..ceaa379474 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -63,7 +63,6 @@ struct _CalendarPrefsDialog { /* General tab */ GtkWidget *system_tz_label; - GtkWidget *timezone; GtkWidget *day_second_zone; GtkWidget *working_days[7]; GtkWidget *week_start_day; diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index cfe4139708..697e8bda7f 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -239,7 +239,7 @@ comp_editor_new_date_edit (EShellSettings *shell_settings, #endif e_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (dedit), "show-week-numbers"); e_binding_new ( diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index e7d602c335..94006a961c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -248,15 +248,6 @@ static GtkActionEntry meeting_entries[] = { }; static void -event_editor_client_changed_cb (EventEditor *ee) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (ee)); - e_meeting_store_set_e_cal (ee->priv->model, client); -} - -static void event_editor_model_changed_cb (EventEditor *ee) { if (!ee->priv->updating) { @@ -369,6 +360,31 @@ event_editor_dispose (GObject *object) } static void +event_editor_constructed (GObject *object) +{ + EventEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = EVENT_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + +static void event_editor_show_categories (CompEditor *editor, gboolean visible) { @@ -445,6 +461,7 @@ event_editor_class_init (EventEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = event_editor_constructor; object_class->dispose = event_editor_dispose; + object_class->constructed = event_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-apts"; @@ -502,10 +519,6 @@ event_editor_init (EventEditor *ee) action = comp_editor_get_action (editor, "send-options"); gtk_action_set_visible (action, FALSE); - g_signal_connect ( - ee, "notify::client", - G_CALLBACK (event_editor_client_changed_cb), NULL); - g_signal_connect_swapped ( ee->priv->model, "row_changed", G_CALLBACK (event_editor_model_changed_cb), ee); @@ -640,7 +653,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 66f21522b5..bd9152afc7 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -2260,7 +2260,7 @@ init_widgets (RecurrencePage *rpage) ecal = E_CALENDAR (priv->preview_calendar); e_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (ecal->calitem), "show-week-numbers"); e_binding_new ( diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 712d2708b9..979e182a8c 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -218,7 +218,7 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone if (start_zone != end_zone) { icaltimezone_convert_time (&end_tt, end_zone, start_zone); } - e_meeting_store_set_zone (priv->model, priv->zone); + e_meeting_store_set_timezone (priv->model, priv->zone); all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; @@ -385,10 +385,14 @@ SchedulePage * schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) { SchedulePagePrivate *priv = spage->priv; + EShellSettings *shell_settings; + EShell *shell; CompEditor *editor; gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "schedule-page.glade", @@ -423,6 +427,18 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) gtk_widget_show (GTK_WIDGET (priv->sel)); gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6); + e_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (priv->sel), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (priv->sel), "use-24-hour-format"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (priv->sel), "week-start-day"); + if (!init_widgets (spage)) { g_message ("schedule_page_construct(): " "Could not initialize the widgets!"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 2829def666..a309a51d91 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -126,15 +126,6 @@ static GtkActionEntry assigned_task_entries[] = { }; static void -task_editor_client_changed_cb (TaskEditor *te) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (te)); - e_meeting_store_set_e_cal (te->priv->model, client); -} - -static void task_editor_model_changed_cb (TaskEditor *te) { if (!te->priv->updating) { @@ -208,6 +199,31 @@ task_editor_dispose (GObject *object) } static void +task_editor_constructed (GObject *object) +{ + TaskEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = TASK_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + +static void task_editor_show_categories (CompEditor *editor, gboolean visible) { @@ -284,6 +300,7 @@ task_editor_class_init (TaskEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = task_editor_constructor; object_class->dispose = task_editor_dispose; + object_class->constructed = task_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-todo"; @@ -356,10 +373,6 @@ task_editor_init (TaskEditor *te) g_error_free (error); } - g_signal_connect ( - te, "notify::client", - G_CALLBACK (task_editor_client_changed_cb), NULL); - g_signal_connect_swapped ( te->priv->model, "row_changed", G_CALLBACK (task_editor_model_changed_cb), te); @@ -465,7 +478,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms); g_object_unref (comp); |