From d261d0b2e46d4793c2d54540782552846535eb60 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 25 Apr 2009 19:37:21 -0400 Subject: Begin migrating calendar settings to EShellSettings. Begin dismantling calendar-config.c and migrating calendar settings to EShellSettings. EShellSettings utilizes GObject properties instead of separate get/set/notify functions for each setting. --- calendar/gui/dialogs/cal-prefs-dialog.c | 53 ++++++++++++--------- calendar/gui/dialogs/cal-prefs-dialog.h | 31 ++++++++++--- calendar/gui/dialogs/comp-editor.c | 81 +++++++++++++++++++++++++-------- calendar/gui/dialogs/comp-editor.h | 2 + calendar/gui/dialogs/event-editor.c | 7 ++- calendar/gui/dialogs/event-editor.h | 1 + calendar/gui/dialogs/event-page.c | 55 ++++++++++++++++++---- calendar/gui/dialogs/memo-editor.c | 7 ++- calendar/gui/dialogs/memo-editor.h | 1 + calendar/gui/dialogs/memo-page.c | 10 +++- calendar/gui/dialogs/task-editor.c | 7 ++- calendar/gui/dialogs/task-editor.h | 1 + calendar/gui/dialogs/task-page.c | 47 +++++++++++++++---- 13 files changed, 230 insertions(+), 73 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 70058bcd89..6d50a406b3 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -31,6 +31,7 @@ #include "../calendar-config.h" #include "cal-prefs-dialog.h" #include +#include #include #include #include @@ -480,7 +481,9 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) } static void -update_system_tz_widgets (CalendarPrefsDialog *prefs) +update_system_tz_widgets (EShellSettings *shell_settings, + GParamSpec *pspec, + CalendarPrefsDialog *prefs) { icaltimezone *zone; @@ -492,15 +495,6 @@ update_system_tz_widgets (CalendarPrefsDialog *prefs) } 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 @@ -511,7 +505,6 @@ 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); @@ -645,11 +638,6 @@ 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_stored (); zone = icaltimezone_get_builtin_timezone (location); @@ -752,13 +740,16 @@ eccp_free (EConfig *ec, GSList *items, void *data) } static void -calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) +calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, + EShell *shell) { GladeXML *gui; ECalConfig *ec; ECalConfigTargetPrefs *target; + EShellSettings *shell_settings; int i; GtkWidget *toplevel; + GtkWidget *widget; GSList *l; const char *working_day_names[] = { "sun_button", @@ -771,6 +762,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) }; char *gladefile; + shell_settings = e_shell_get_shell_settings (shell); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "cal-prefs-dialog.glade", NULL); @@ -794,8 +787,20 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) l = g_slist_prepend (l, &eccp_items[i]); e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + widget = glade_xml_get_widget (gui, "use-system-tz-check"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "active"); + g_signal_connect ( + G_OBJECT (shell_settings), "notify::cal-use-system-timezone", + G_CALLBACK (update_system_tz_widgets), prefs); + + widget = glade_xml_get_widget (gui, "timezone"); + e_mutual_binding_new_with_negation ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "sensitive"); + /* 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"); @@ -865,14 +870,18 @@ calendar_prefs_dialog_get_type (void) } GtkWidget * -calendar_prefs_dialog_new (void) +calendar_prefs_dialog_new (EShell *shell) { CalendarPrefsDialog *dialog; - dialog = (CalendarPrefsDialog *) g_object_new (calendar_prefs_dialog_get_type (), NULL); - calendar_prefs_dialog_construct (dialog); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + dialog = g_object_new (CALENDAR_TYPE_PREFS_DIALOG, NULL); + + /* FIXME Kill this function. */ + calendar_prefs_dialog_construct (dialog, shell); - return (GtkWidget *) dialog; + return GTK_WIDGET (dialog); } /* called by libglade to create our custom EDateEdit widgets. */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 0ef1e4a667..84c1873e9a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -21,13 +21,33 @@ * */ -#ifndef _CAL_PREFS_DIALOG_H_ -#define _CAL_PREFS_DIALOG_H_ +#ifndef CAL_PREFS_DIALOG_H +#define CAL_PREFS_DIALOG_H #include #include #include #include +#include + +/* Standard GObject macros */ +#define CALENDAR_TYPE_PREFS_DIALOG \ + (calendar_prefs_dialog_get_type ()) +#define CALENDAR_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialog)) +#define CALENDAR_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) +#define CALENDAR_IS_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_IS_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_PREFS_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) G_BEGIN_DECLS @@ -42,7 +62,6 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ - GtkWidget *use_system_tz_check; GtkWidget *system_tz_label; GtkWidget *timezone; GtkWidget *day_second_zone; @@ -93,9 +112,9 @@ struct _CalendarPrefsDialogClass { GtkVBoxClass parent; }; -GType calendar_prefs_dialog_get_type (void); -GtkWidget *calendar_prefs_dialog_new (void); +GType calendar_prefs_dialog_get_type (void); +GtkWidget * calendar_prefs_dialog_new (EShell *shell); G_END_DECLS -#endif /* _CAL_PREFS_DIALOG_H_ */ +#endif /* CAL_PREFS_DIALOG_H */ diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4cf74613cf..4db6c66b12 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -76,6 +76,9 @@ /* Private part of the CompEditor structure */ struct _CompEditorPrivate { + + gpointer shell; /* weak pointer */ + /* Client to use */ ECal *client; @@ -125,6 +128,7 @@ enum { PROP_CHANGED, PROP_CLIENT, PROP_FLAGS, + PROP_SHELL, PROP_SUMMARY }; @@ -1231,6 +1235,17 @@ comp_editor_setup_recent_menu (CompEditor *editor) gtk_ui_manager_ensure_update (ui_manager); } +static void +comp_editor_set_shell (CompEditor *editor, + EShell *shell) +{ + g_return_if_fail (editor->priv->shell == NULL); + + editor->priv->shell = shell; + + g_object_add_weak_pointer (G_OBJECT (shell), &editor->priv->shell); +} + static void comp_editor_set_property (GObject *object, guint property_id, @@ -1256,6 +1271,12 @@ comp_editor_set_property (GObject *object, g_value_get_int (value)); return; + case PROP_SHELL: + comp_editor_set_shell ( + COMP_EDITOR (object), + g_value_get_object (value)); + return; + case PROP_SUMMARY: comp_editor_set_summary ( COMP_EDITOR (object), @@ -1291,6 +1312,12 @@ comp_editor_get_property (GObject *object, COMP_EDITOR (object))); return; + case PROP_SHELL: + g_value_set_object ( + value, comp_editor_get_shell ( + COMP_EDITOR (object))); + return; + case PROP_SUMMARY: g_value_set_string ( value, comp_editor_get_summary ( @@ -1366,42 +1393,39 @@ static void comp_editor_map (GtkWidget *widget) { CompEditor *editor = COMP_EDITOR (widget); - GConfBridge *bridge = gconf_bridge_get (); + GConfBridge *bridge; GtkAction *action; + const gchar *key; + + bridge = gconf_bridge_get (); /* Give subclasses a chance to construct their pages before * we fiddle with their widgets. That's why we don't do this * until after object construction. */ + key = "/apps/evolution/calendar/display/show_categories"; action = comp_editor_get_action (editor, "view-categories"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_CATEGORIES, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_role"; action = comp_editor_get_action (editor, "view-role"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_ROLE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_rsvp"; action = comp_editor_get_action (editor, "view-rsvp"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_RSVP, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_status"; action = comp_editor_get_action (editor, "view-status"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_STATUS, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_timezone"; action = comp_editor_get_action (editor, "view-time-zone"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TIMEZONE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_type"; action = comp_editor_get_action (editor, "view-type"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TYPE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); /* Chain up to parent's map() method. */ GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget); @@ -1508,6 +1532,17 @@ comp_editor_class_init (CompEditorClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property ( + object_class, + PROP_SHELL, + g_param_spec_object ( + "shell", + NULL, + NULL, + E_TYPE_SHELL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property ( object_class, PROP_SUMMARY, @@ -1849,6 +1884,14 @@ comp_editor_get_classification (CompEditor *editor) return gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); } +EShell * +comp_editor_get_shell (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->shell; +} + void comp_editor_set_summary (CompEditor *editor, const gchar *summary) diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 7fdc17ba16..a6231d55b5 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -29,6 +29,7 @@ #include #include "../itip-utils.h" #include "comp-editor-page.h" +#include /* Standard GObject macros */ #define TYPE_COMP_EDITOR \ @@ -108,6 +109,7 @@ void comp_editor_set_classification (CompEditor *editor, ECalComponentClassification classification); ECalComponentClassification comp_editor_get_classification (CompEditor *editor); +EShell * comp_editor_get_shell (CompEditor *editor); void comp_editor_set_summary (CompEditor *editor, const gchar *summary); const gchar * comp_editor_get_summary (CompEditor *editor); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index c39e25acd5..be12f71ab8 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -667,13 +667,16 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo * editor could not be created. **/ CompEditor * -event_editor_new (ECal *client, CompEditorFlags flags) +event_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (client), NULL); return g_object_new ( TYPE_EVENT_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h index c050b92dfb..c2dde76673 100644 --- a/calendar/gui/dialogs/event-editor.h +++ b/calendar/gui/dialogs/event-editor.h @@ -66,6 +66,7 @@ struct _EventEditorClass { GType event_editor_get_type (void); CompEditor * event_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void event_editor_show_meeting (EventEditor *ee); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index b0fcdc4632..7c548797ab 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -368,9 +368,11 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD EventPagePrivate *priv = epage->priv; CompEditor *editor; ECal *client; + GtkAction *action; struct icaltimetype *start_tt, *end_tt, implied_tt; icaltimezone *start_zone = NULL, *def_zone = NULL; gboolean all_day_event, homezone=TRUE; + gboolean show_timezone; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); client = comp_editor_get_client (editor); @@ -442,7 +444,9 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid(def_zone), icaltimezone_get_tzid (start_zone))) homezone = FALSE; - event_page_set_show_timezone (epage, (calendar_config_get_show_timezone()|| !homezone) & !all_day_event); + action = comp_editor_get_action (editor, "view-time-zone"); + show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event); /*unblock the endtimezone widget*/ g_signal_handlers_unblock_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -1994,6 +1998,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) CompEditor *editor; GtkAction *action; gboolean date_set; + gboolean active; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2072,7 +2077,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) TRUE); } - event_page_set_show_timezone (epage, calendar_config_get_show_timezone() & !all_day); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active & !all_day); + g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -2154,10 +2162,12 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms static gboolean get_widgets (EventPage *epage) { + CompEditor *editor; CompEditorPage *page = COMP_EDITOR_PAGE (epage); GtkEntryCompletion *completion; EventPagePrivate *priv; GSList *accel_groups; + GtkAction *action; GtkWidget *toplevel; GtkWidget *sw; @@ -2165,6 +2175,8 @@ get_widgets (EventPage *epage) #define GW(name) glade_xml_get_widget (priv->xml, name) + editor = comp_editor_page_get_editor (page); + priv->main = GW ("event-page"); if (!priv->main) return FALSE; @@ -2186,7 +2198,8 @@ get_widgets (EventPage *epage) gtk_widget_show (priv->status_icons); - if (!calendar_config_get_show_timezone()) { + action = comp_editor_get_action (editor, "view-time-zone"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->timezone_label); gtk_widget_hide (priv->start_timezone); } else { @@ -2778,7 +2791,9 @@ init_widgets (EventPage *epage) GtkTextBuffer *text_buffer; icaltimezone *zone; char *combo_label = NULL; + GtkAction *action; GtkTreeSelection *selection; + gboolean active; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2835,11 +2850,28 @@ init_widgets (EventPage *epage) g_signal_connect((priv->start_timezone), "changed", G_CALLBACK (start_timezone_changed_cb), epage); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); + + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); + + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); + + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); @@ -2875,7 +2907,8 @@ init_widgets (EventPage *epage) gtk_widget_show (GTK_WIDGET (priv->list_view)); /* categories */ - if (!calendar_config_get_show_categories()) { + action = comp_editor_get_action (editor, "view-categories"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->categories_btn); gtk_widget_hide (priv->categories); } else { @@ -2966,7 +2999,9 @@ init_widgets (EventPage *epage) e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); - event_page_set_show_timezone (epage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active); return TRUE; } diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index ec7ab841c9..8de23430c9 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -163,11 +163,14 @@ memo_editor_init (MemoEditor *me) * editor could not be created. **/ CompEditor * -memo_editor_new (ECal *client, CompEditorFlags flags) +memo_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_MEMO_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h index b45edd18ce..34db230121 100644 --- a/calendar/gui/dialogs/memo-editor.h +++ b/calendar/gui/dialogs/memo-editor.h @@ -68,6 +68,7 @@ struct _MemoEditorClass { GType memo_editor_get_type (void); CompEditor * memo_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); G_END_DECLS diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 4f8c37c0a3..a15c1b1f88 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -929,9 +929,14 @@ to_button_clicked_cb (GtkButton *button, static gboolean init_widgets (MemoPage *mpage) { + CompEditor *editor; MemoPagePrivate *priv = mpage->priv; GtkTextBuffer *buffer; GtkTextView *view; + GtkAction *action; + gboolean active; + + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); /* Generic informative messages */ gtk_widget_hide (priv->info_hbox); @@ -996,8 +1001,9 @@ init_widgets (MemoPage *mpage) G_CALLBACK (comp_editor_page_changed), mpage); } - memo_page_set_show_categories ( - mpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + memo_page_set_show_categories (mpage, active); return TRUE; } diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index b7edd0a566..9ee3f02a17 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -492,13 +492,16 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool * editor could not be created. **/ CompEditor * -task_editor_new (ECal *client, CompEditorFlags flags) +task_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_TASK_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 9376b4149a..64180ec1fb 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -66,6 +66,7 @@ struct _TaskEditorClass { GType task_editor_get_type (void); CompEditor * task_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void task_editor_show_assignment (TaskEditor *te); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 4c5a5536ea..d020d5cd4f 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -451,12 +451,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; CompEditor *editor; CompEditorFlags flags; + GtkAction *action; ECal *client; GSList *l; icalcomponent *icalcomp; const char *categories, *uid; icaltimezone *zone, *default_zone; gchar *backend_addr = NULL; + gboolean active; tpage = TASK_PAGE (page); priv = tpage->priv; @@ -538,7 +540,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone ? zone : default_zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); if (!(flags & COMP_EDITOR_NEW_ITEM) && !zone) { GtkAction *action; @@ -1829,12 +1834,17 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage) static gboolean init_widgets (TaskPage *tpage) { + CompEditor *editor; TaskPagePrivate *priv; + GtkAction *action; GtkTextBuffer *text_buffer; icaltimezone *zone; + gboolean active; priv = tpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); + /* Make sure the EDateEdit widgets use our timezones to get the current time. */ e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date), @@ -1930,15 +1940,36 @@ init_widgets (TaskPage *tpage) zone = calendar_config_get_icaltimezone (); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); + + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); + + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); + + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); - task_page_set_show_categories (tpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_categories (tpage, active); return TRUE; } -- cgit