diff options
Diffstat (limited to 'calendar/gui/dialogs/event-page.c')
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 113 |
1 files changed, 63 insertions, 50 deletions
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index b2ac6b55db..fa1faa2f79 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -381,9 +381,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); @@ -455,7 +457,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); @@ -1815,15 +1819,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + EventPage *page) { - EventPage *page; - EventPagePrivate *priv; - - page = EVENT_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } static void @@ -2013,6 +2012,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)); @@ -2091,7 +2091,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); @@ -2173,10 +2176,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; @@ -2184,6 +2189,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; @@ -2205,7 +2212,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 { @@ -2483,14 +2491,10 @@ times_updated (EventPage *epage, gboolean adjust_end_time) * start date < end date and we set the "all day event" button as appropriate. */ static void -start_date_changed_cb (GtkWidget *dedit, gpointer data) +start_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - hour_minute_changed (epage); - times_updated (epage, TRUE); } @@ -2498,12 +2502,9 @@ start_date_changed_cb (GtkWidget *dedit, gpointer data) * start date < end date and we set the "all day event" button as appropriate. */ static void -end_date_changed_cb (GtkWidget *dedit, gpointer data) +end_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - times_updated (epage, FALSE); } @@ -2512,15 +2513,12 @@ end_date_changed_cb (GtkWidget *dedit, gpointer data) * labels on the other notebook pages. */ static void -start_timezone_changed_cb (GtkWidget *widget, gpointer data) +start_timezone_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; + EventPagePrivate *priv = epage->priv; icaltimezone *zone; - epage = EVENT_PAGE (data); - priv = epage->priv; - if (priv->sync_timezones) { zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), TRUE); @@ -2537,17 +2535,13 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data) * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - GtkWidget *entry; + GtkEntry *entry; - epage = EVENT_PAGE (data); - priv = epage->priv; - - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (epage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } void @@ -2666,13 +2660,10 @@ set_subscriber_info_string (EventPage *epage, const char *backend_address) } static void -alarm_changed_cb (GtkWidget *widget, gpointer data) +alarm_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; + EventPagePrivate *priv = epage->priv; if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; @@ -2814,7 +2805,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)); @@ -2871,11 +2864,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); @@ -2911,7 +2921,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 { @@ -3005,7 +3016,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; } |