diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-04-19 16:57:48 +0800 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-04-19 16:57:48 +0800 |
commit | 81e6232269b61e0abe287f4cf183988bf08fc04b (patch) | |
tree | c8aac499cacf475b3fa19376e0edebc6279f6bb3 /calendar/gui | |
parent | e6c2e5a37c3128351a4e78e0cb27a56b43a0bba1 (diff) | |
download | gsoc2013-evolution-81e6232269b61e0abe287f4cf183988bf08fc04b.tar.gz gsoc2013-evolution-81e6232269b61e0abe287f4cf183988bf08fc04b.tar.zst gsoc2013-evolution-81e6232269b61e0abe287f4cf183988bf08fc04b.zip |
Re-work the over-complicated event editor as a tabbed notebook.
Thanks to Sashwaat.
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 110 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 59 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 47 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.h | 2 |
5 files changed, 172 insertions, 54 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index e8acf21db5..cbdeecee2d 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -74,8 +74,6 @@ #define d(x) -static gboolean comp_lite = FALSE; - /* Private part of the CompEditor structure */ struct _CompEditorPrivate { @@ -426,7 +424,7 @@ save_comp (CompEditor *editor) clone = e_cal_component_clone (priv->comp); comp_editor_copy_new_attendees (clone, priv->comp); for (l = priv->pages; l != NULL; l = l->next) { - if (!comp_editor_page_fill_component (l->data, clone)) { + if (IS_COMP_EDITOR_PAGE(l->data) && !comp_editor_page_fill_component (l->data, clone)) { g_object_unref (clone); g_hash_table_destroy (timezones); comp_editor_show_page (editor, COMP_EDITOR_PAGE (l->data)); @@ -434,7 +432,8 @@ save_comp (CompEditor *editor) } /* retrieve all timezones */ - comp_editor_page_fill_timezones (l->data, timezones); + if (IS_COMP_EDITOR_PAGE(l->data)) + comp_editor_page_fill_timezones (l->data, timezones); } /* If we are not the organizer, we don't update the sequence number */ @@ -1631,8 +1630,6 @@ comp_editor_init (CompEditor *editor) e_ui_manager_set_express_mode (E_UI_MANAGER (priv->ui_manager), e_shell_get_express_mode (shell)); - if (comp_lite) - gtk_window_set_default_size ((GtkWindow *) editor, 800, 450); gtk_window_add_accel_group ( GTK_WINDOW (editor), gtk_ui_manager_get_accel_group (priv->ui_manager)); @@ -1723,24 +1720,25 @@ comp_editor_init (CompEditor *editor) container = widget; - widget = comp_editor_get_managed_widget (editor, "/main-menu"); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - gtk_widget_set_visible (widget, !e_shell_get_meego_mode (shell)); - - if (!comp_lite) { - widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); + if (!e_shell_get_express_mode (shell)) { + widget = comp_editor_get_managed_widget (editor, "/main-menu"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - gtk_widget_show (widget); + gtk_widget_set_visible (widget, !e_shell_get_meego_mode (shell)); } + widget = comp_editor_get_managed_widget (editor, "/main-toolbar"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + widget = e_attachment_paned_new (); gtk_container_set_border_width (GTK_CONTAINER (widget), 6); gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); priv->attachment_view = g_object_ref (widget); gtk_widget_show (widget); - if (comp_lite) { - GtkWidget *tmp, *tmp1, *tmp_box, *cont; + if (e_shell_get_express_mode (shell)) { + /*GtkWidget *tmp, *tmp1, *tmp_box, */ + GtkWidget *cont; GtkWidget *combo; e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), TRUE); @@ -1751,7 +1749,7 @@ comp_editor_init (CompEditor *editor) gtk_widget_hide (combo); cont = e_attachment_paned_get_controls_container ( E_ATTACHMENT_PANED (widget)); - + /* tmp_box = gtk_hbox_new (FALSE, 0); tmp = gtk_hbox_new (FALSE, 0); tmp1 = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON); @@ -1771,12 +1769,12 @@ comp_editor_init (CompEditor *editor) gtk_widget_show(tmp_box); gtk_box_pack_end (GTK_BOX (cont), tmp_box, FALSE, FALSE, 4); - + */ } container = e_attachment_paned_get_content_area ( E_ATTACHMENT_PANED (priv->attachment_view)); - if (comp_lite) { + if (e_shell_get_express_mode (shell)) { scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ((GtkScrolledWindow *)scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scroll); @@ -1784,14 +1782,14 @@ comp_editor_init (CompEditor *editor) } widget = gtk_notebook_new (); - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); - if (!comp_lite) + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), e_shell_get_express_mode (shell)); + if (!e_shell_get_express_mode (shell)) gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); else gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *) scroll, widget); priv->notebook = GTK_NOTEBOOK (widget); gtk_widget_show (widget); - if (comp_lite) + if (e_shell_get_express_mode (shell)) gtk_widget_set_size_request (scroll, 300, -1); comp_editor_setup_recent_menu (editor); @@ -2267,6 +2265,51 @@ page_unmapped_cb (GtkWidget *page_widget, } /** + * comp_editor_append_widget: + * @editor: A component editor + * @page: A component editor page + * @label: Label of the page. Should be NULL if add is FALSE. + * @add: Add's the page into the notebook if TRUE + * + * Appends a page to the notebook if add is TRUE else + * just adds it to the list of pages. + **/ +void +comp_editor_append_widget (CompEditor *editor, + GtkWidget *page, + const gchar *label, + gboolean add) +{ + CompEditorPrivate *priv; + GtkWidget *label_widget = NULL; + + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + g_object_ref (page); + + if (label) + label_widget = gtk_label_new_with_mnemonic (label); + + priv->pages = g_list_append (priv->pages, page); + + if (add) + gtk_notebook_append_page (priv->notebook, page, label_widget); + + /* Listen for when the page is mapped/unmapped so we can + install/uninstall the appropriate GtkAccelGroup. + g_signal_connect ( + page, "map", + G_CALLBACK (page_mapped_cb), page); + g_signal_connect( + page, "unmap", + G_CALLBACK (page_unmapped_cb), page); + */ + +} + +/** * comp_editor_append_page: * @editor: A component editor * @page: A component editor page @@ -2557,8 +2600,10 @@ fill_widgets (CompEditor *editor) g_signal_handlers_block_by_func ( action, G_CALLBACK (action_classification_cb), editor); - for (iter = priv->pages; iter != NULL; iter = iter->next) - comp_editor_page_fill_widgets (iter->data, priv->comp); + for (iter = priv->pages; iter != NULL; iter = iter->next) { + if (IS_COMP_EDITOR_PAGE(iter->data)) + comp_editor_page_fill_widgets (iter->data, priv->comp); + } g_signal_handlers_unblock_by_func ( action, G_CALLBACK (action_classification_cb), editor); @@ -2801,8 +2846,10 @@ comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) comp = e_cal_component_clone (priv->comp); comp_editor_copy_new_attendees (comp, priv->comp); if (priv->changed) { - for (l = priv->pages; l != NULL; l = l->next) - all_ok = comp_editor_page_fill_component (l->data, comp) && all_ok; + for (l = priv->pages; l != NULL; l = l->next) { + if (IS_COMP_EDITOR_PAGE(l->data)) + all_ok = comp_editor_page_fill_component (l->data, comp) && all_ok; + } } if (correct) @@ -2967,7 +3014,7 @@ page_dates_changed_cb (CompEditor *editor, GList *l; for (l = priv->pages; l != NULL; l = l->next) - if (page != (CompEditorPage *) l->data) + if (page != (CompEditorPage *) l->data && IS_COMP_EDITOR_PAGE(l->data)) comp_editor_page_set_dates (l->data, dates); if (!priv->warned && priv->existing_org && !priv->user_org && !(editor->priv->flags & COMP_EDITOR_NEW_ITEM)) { @@ -3024,14 +3071,3 @@ obj_removed_cb (ECal *client, close_dialog (editor); } -gboolean -comp_editor_get_lite () -{ - return comp_lite; -} - -void -comp_editor_set_lite (gboolean status) -{ - comp_lite = status; -} diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 4871beae8f..bd26ce8b66 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -127,6 +127,11 @@ void comp_editor_append_page (CompEditor *editor, CompEditorPage *page, const gchar *label, gboolean add); +void comp_editor_append_widget (CompEditor *editor, + GtkWidget *page, + const gchar *label, + gboolean add); + void comp_editor_remove_page (CompEditor *editor, CompEditorPage *page); void comp_editor_show_page (CompEditor *editor, @@ -165,9 +170,6 @@ GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); CompEditor * comp_editor_find_instance (const gchar *uid); -void comp_editor_set_lite (gboolean status); -gboolean comp_editor_get_lite (void); - G_END_DECLS #endif diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 8ca6605ee4..687f26a5d5 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -90,12 +90,18 @@ static const gchar *ui = " </menu>" " </menubar>" " <toolbar name='main-toolbar'>" -" <placeholder name='content'>" -" <toolitem action='alarms'/>" -" <toolitem action='show-time-busy'/>" -" <toolitem action='recurrence'/>" -" <toolitem action='all-day-event'/>" -" <toolitem action='free-busy'/>" +" <placeholder name='content'>\n" +"#if !EXPRESS\n" +" <toolitem action='alarms'/>\n" +"#endif\n" +" <toolitem action='show-time-busy'/>\n" +"#if !EXPRESS\n" +" <toolitem action='recurrence'/>\n" +"#endif\n" +" <toolitem action='all-day-event'/>\n" +"#if !EXPRESS\n" +" <toolitem action='free-busy'/>\n" +"#endif\n" " </placeholder>" " </toolbar>" "</ui>"; @@ -272,6 +278,8 @@ event_editor_constructor (GType type, GtkActionGroup *action_group; ECal *client; gboolean is_meeting; + GtkWidget *alarm_page; + GtkWidget *attendee_page; /* Chain up to parent's constructor() method. */ object = G_OBJECT_CLASS (event_editor_parent_class)->constructor ( @@ -305,11 +313,34 @@ event_editor_constructor (GType type, priv->recur_page = recurrence_page_new (editor); page = COMP_EDITOR_PAGE (priv->recur_page); - gtk_container_add ( - GTK_CONTAINER ((GTK_DIALOG (priv->recur_window)->vbox)), - comp_editor_page_get_widget (page)); - gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->recur_window))); - comp_editor_append_page (editor, page, NULL, FALSE); + if (!e_shell_get_express_mode(e_shell_get_default())) { + gtk_container_add ( + GTK_CONTAINER ((GTK_DIALOG (priv->recur_window)->vbox)), + comp_editor_page_get_widget (page)); + gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (priv->recur_window))); + comp_editor_append_page (editor, page, NULL, FALSE); + } else { + comp_editor_append_page (editor, page, _("_Recurrence"), TRUE); + } + + if (e_shell_get_express_mode(e_shell_get_default())) { + ENameSelector *name_selector; + + priv->sched_page = schedule_page_new (priv->model, editor); + page = COMP_EDITOR_PAGE (priv->sched_page); + + name_selector = event_page_get_name_selector (priv->event_page); + schedule_page_set_name_selector (priv->sched_page, name_selector); + + comp_editor_append_page (editor, page, _("_Free/Busy"), TRUE); + schedule_page_update_free_busy (priv->sched_page); + + /* Alarm page */ + alarm_page = event_page_get_alarm_page (priv->event_page); + comp_editor_append_widget (editor, alarm_page, _("_Alarm"), TRUE); + g_object_unref(alarm_page); + + } if (is_meeting) { @@ -326,6 +357,12 @@ event_editor_constructor (GType type, event_page_set_meeting (priv->event_page, TRUE); priv->meeting_shown=TRUE; + + if (e_shell_get_express_mode(e_shell_get_default())) { + attendee_page = event_page_get_attendee_page (priv->event_page); + comp_editor_append_widget (editor, attendee_page, _("Attendee_s"), TRUE); + g_object_unref(attendee_page); + } } return object; diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index a74cb64991..7627e4af4c 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -825,7 +825,8 @@ sensitize_widgets (EventPage *epage) } else { gtk_widget_show (priv->calendar_label); gtk_widget_show (priv->list_box); - gtk_widget_show (priv->attendee_box); + if (e_shell_get_express_mode(e_shell_get_default())) + gtk_widget_show (priv->attendee_box); gtk_widget_show (priv->organizer); gtk_label_set_text_with_mnemonic ((GtkLabel *) priv->org_cal_label, _("Or_ganizer:")); } @@ -2194,7 +2195,7 @@ get_widgets (EventPage *epage) priv->invite = GW ("invite"); priv->invite_label = GW ("invite-label"); - if (comp_editor_get_lite ()) + if (e_shell_get_express_mode (e_shell_get_default ())) gtk_widget_hide (priv->invite); else gtk_widget_hide (priv->invite_label); @@ -2234,7 +2235,6 @@ get_widgets (EventPage *epage) priv->source_selector = GW ("source"); -#undef GW e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/calendar/sources"); @@ -3254,3 +3254,44 @@ event_page_remove_all_attendees (EventPage *epage) e_meeting_list_view_remove_all_attendees_from_name_selector (E_MEETING_LIST_VIEW (priv->list_view)); } + +GtkWidget * +event_page_get_alarm_page (EventPage *epage) +{ + EventPagePrivate *priv; + GtkWidget *alarm_page, *tmp; + + g_return_val_if_fail (epage != NULL, NULL); + g_return_val_if_fail (IS_EVENT_PAGE (epage), NULL); + + priv = epage->priv; + + tmp = GW("dialog-vbox1"); + alarm_page = GW("vbox2"); + g_object_ref(alarm_page); + gtk_container_remove ((GtkContainer *)tmp, alarm_page); + + return alarm_page; +} + +GtkWidget * +event_page_get_attendee_page (EventPage *epage) +{ + EventPagePrivate *priv; + GtkWidget *apage; + + g_return_val_if_fail (epage != NULL, NULL); + g_return_val_if_fail (IS_EVENT_PAGE (epage), NULL); + + priv = epage->priv; + + apage = priv->list_box; + g_object_ref(apage); + gtk_container_remove ((GtkContainer *)gtk_widget_get_parent(apage), apage); + gtk_widget_hide (priv->attendee_box); + + return apage; +} + + +#undef GW diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h index ab43c0f7ba..a4513e4c68 100644 --- a/calendar/gui/dialogs/event-page.h +++ b/calendar/gui/dialogs/event-page.h @@ -109,6 +109,8 @@ ENameSelector * event_page_get_name_selector (EventPage *epage); void event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee); void event_page_remove_all_attendees (EventPage *epage); +GtkWidget * event_page_get_alarm_page (EventPage *epage); +GtkWidget * event_page_get_attendee_page (EventPage *epage); G_END_DECLS |