diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-06 01:21:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-06 01:21:42 +0800 |
commit | 16d914886110d57eaf8946000c365de2007728b3 (patch) | |
tree | dc91c2e17d9febfc121cfdc3b375cc75162f1877 /calendar | |
parent | c3e0648d8b5a1d73f82f0a7691b9ab1320248392 (diff) | |
parent | a30e0738880809f8e3a6d05a66f82081d91c21a0 (diff) | |
download | gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.tar.gz gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.tar.zst gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.zip |
Merge branch 'master' into kill-bonobo
Conflicts:
calendar/gui/dialogs/comp-editor.c
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 29 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 81 |
2 files changed, 70 insertions, 40 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index cf8d77668c..440cf35388 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -197,6 +197,14 @@ comp_editor_weak_notify_cb (gpointer unused, active_editors = g_list_remove (active_editors, where_the_object_was); } +static void +attachment_store_changed_cb (CompEditor *editor) +{ + /* Mark the editor as changed so it prompts about unsaved + changes on close */ + comp_editor_set_changed (editor, TRUE); +} + static GSList * get_attachment_list (CompEditor *editor) { @@ -1569,6 +1577,7 @@ comp_editor_init (CompEditor *editor) { CompEditorPrivate *priv; EAttachmentView *view; + EAttachmentStore *store; GdkDragAction drag_actions; GtkTargetList *target_list; GtkTargetEntry *targets; @@ -1710,6 +1719,18 @@ comp_editor_init (CompEditor *editor) gtk_window_set_type_hint ( GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); + /* Listen for attachment store changes. */ + + store = e_attachment_view_get_store (view); + + g_signal_connect_swapped ( + store, "row-deleted", + G_CALLBACK (attachment_store_changed_cb), editor); + + g_signal_connect_swapped ( + store, "row-inserted", + G_CALLBACK (attachment_store_changed_cb), editor); + /* FIXME Shell should be passed in. */ shell = e_shell_get_default (); e_shell_watch_window (shell, GTK_WINDOW (editor)); @@ -1765,14 +1786,6 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) } } -static void -attachment_store_changed_cb (CompEditor *editor) -{ - /* Mark the editor as changed so it prompts about unsaved - changes on close */ - comp_editor_set_changed (editor, TRUE); -} - /* Menu callbacks */ static void diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 7c548797ab..c7b6050d3e 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -64,6 +64,34 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), TYPE_EVENT_PAGE, EventPagePrivate)) +enum { + ALARM_NONE, + ALARM_15_MINUTES, + ALARM_1_HOUR, + ALARM_1_DAY, + ALARM_USER_TIME, + ALARM_CUSTOM +}; + +static const int alarm_map_with_user_time[] = { + ALARM_NONE, + ALARM_15_MINUTES, + ALARM_1_HOUR, + ALARM_1_DAY, + ALARM_USER_TIME, + ALARM_CUSTOM, + -1 +}; + +static const int alarm_map_without_user_time[] = { + ALARM_NONE, + ALARM_15_MINUTES, + ALARM_1_HOUR, + ALARM_1_DAY, + ALARM_CUSTOM, + -1 +}; + /* Private part of the EventPage structure */ struct _EventPagePrivate { /* Glade XML data */ @@ -159,6 +187,9 @@ struct _EventPagePrivate { gboolean is_meeting; GtkWidget *alarm_list_dlg_widget; + + /* either with-user-time or without it */ + const int *alarm_map; }; static GtkWidget *event_page_get_widget (CompEditorPage *page); @@ -265,27 +296,9 @@ event_page_init (EventPage *epage) epage->priv = EVENT_PAGE_GET_PRIVATE (epage); epage->priv->deleted_attendees = g_ptr_array_new (); epage->priv->alarm_interval = -1; + epage->priv->alarm_map = alarm_map_with_user_time; } -enum { - ALARM_NONE, - ALARM_15_MINUTES, - ALARM_1_HOUR, - ALARM_1_DAY, - ALARM_USER_TIME, - ALARM_CUSTOM -}; - -static const int alarm_map[] = { - ALARM_NONE, - ALARM_15_MINUTES, - ALARM_1_HOUR, - ALARM_1_DAY, - ALARM_USER_TIME, - ALARM_CUSTOM, - -1 -}; - static void set_busy_time_menu (EventPage *epage, gboolean active) { @@ -492,7 +505,7 @@ clear_widgets (EventPage *epage) set_busy_time_menu (epage, TRUE); /* Alarm */ - e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, priv->alarm_map); /* Categories */ e_dialog_editable_set (priv->categories, NULL); @@ -732,9 +745,9 @@ sensitize_widgets (EventPage *epage) sensitize = !read_only && sens; - alarm = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE; + alarm = e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE; custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL) || - e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; + e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) == ALARM_CUSTOM ? TRUE:FALSE; if (alarm && !priv->alarm_icon) { priv->alarm_icon = create_image_event_box ("stock_bell", _("This event has alarms")); @@ -837,7 +850,8 @@ event_page_set_meeting (EventPage *page, gboolean set) g_return_if_fail (IS_EVENT_PAGE (page)); page->priv->is_meeting = set; - sensitize_widgets (page); + if (page->priv->comp) + sensitize_widgets (page); } void @@ -1078,9 +1092,9 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) alarms = e_cal_component_get_alarm_uids (comp); if (!is_custom_alarm_uid_list (comp, alarms, priv->old_summary, priv->alarm_units, priv->alarm_interval, &alarm_type)) - e_dialog_combo_box_set (priv->alarm_time_combo, alarm_type, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, alarm_type, priv->alarm_map); else - e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_CUSTOM, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_CUSTOM, priv->alarm_map); for (list = alarms; list != NULL; list = list->next) { ECalComponentAlarm *ca; @@ -1092,7 +1106,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) cal_obj_uid_list_free (alarms); } else { - e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, alarm_map); + e_dialog_combo_box_set (priv->alarm_time_combo, ALARM_NONE, priv->alarm_map); } g_signal_handlers_unblock_matched (priv->alarm_time_combo, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_unblock_matched (priv->alarm_list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -1286,8 +1300,8 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* Alarm */ e_cal_component_remove_all_alarms (comp); - if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { - if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) == ALARM_CUSTOM) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) == ALARM_CUSTOM) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid_iter; @@ -1354,7 +1368,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: trigger.u.rel_duration.minutes = 15; @@ -2651,7 +2665,7 @@ alarm_changed_cb (GtkWidget *widget, { EventPagePrivate *priv = epage->priv; - if (e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map) != ALARM_NONE) { + if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; ECalComponentAlarmTrigger trigger; icalcomponent *icalcomp; @@ -2666,7 +2680,7 @@ alarm_changed_cb (GtkWidget *widget, trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; trigger.u.rel_duration.is_neg = 1; - alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, alarm_map); + alarm_type = e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map); switch (alarm_type) { case ALARM_15_MINUTES: e_alarm_list_clear (priv->alarm_list_store); @@ -2956,10 +2970,13 @@ init_widgets (EventPage *epage) if (combo_label) { gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), combo_label); g_free (combo_label); + priv->alarm_map = alarm_map_with_user_time; + } else { + priv->alarm_map = alarm_map_without_user_time; } gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("Customize")); - gtk_combo_box_append_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("None")); + gtk_combo_box_prepend_text (GTK_COMBO_BOX (priv->alarm_time_combo), _("None")); g_signal_connect_swapped ( priv->alarm_time_combo, "changed", |