diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-12-19 07:23:48 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-12-19 11:38:00 +0800 |
commit | 4cbbdedf522a6ac10df93a128bbf25f67173d66e (patch) | |
tree | fab7bf95e0927e4fa98c58a659e310afff7153ee /modules | |
parent | a1efb837566cdac798cd8777dd34e06e9782cf61 (diff) | |
download | gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.gz gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.zst gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.zip |
Refactor the EShell search API.
Move the search interface to a new widget: EShellSearchbar
The current search rule is now stored in EShellView, and the search
context in EShellViewClass similar to GalViewCollection (since it's
class-specific, not instance-specific).
Also add a couple new signals to EShellView: "clear-search" and
"custom-search" ("custom" refers to an advanced search or a saved
search -- something more complex than a quick search).
Still working out a few kinks. The search entry is clearly trying to
be too many things. We need a different way of indicating that you're
looking at search results. Perhaps a search results banner similar to
Nautilus.
Diffstat (limited to 'modules')
23 files changed, 322 insertions, 131 deletions
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index 46d9824f2e..5eb4459b7b 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -520,6 +520,9 @@ void e_book_shell_content_set_current_view (EBookShellContent *book_shell_content, EAddressbookView *addressbook_view) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSearchbar *searchbar; EBookShellView *book_shell_view; GtkNotebook *notebook; GtkWidget *child; @@ -528,6 +531,12 @@ e_book_shell_content_set_current_view (EBookShellContent *book_shell_content, g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content)); g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view)); + shell_content = E_SHELL_CONTENT (book_shell_content); + shell_view = e_shell_content_get_shell_view (shell_content); + + book_shell_view = E_BOOK_SHELL_VIEW (shell_view); + searchbar = e_book_shell_content_get_searchbar (book_shell_content); + notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook); child = GTK_WIDGET (addressbook_view); page_num = gtk_notebook_page_num (notebook, child); @@ -537,26 +546,33 @@ e_book_shell_content_set_current_view (EBookShellContent *book_shell_content, gtk_notebook_set_current_page (notebook, page_num); if (old_page_num != page_num) { - EShellContent *shell_content; + EActionComboBox *combo_box; + GtkRadioAction *action; gint filter_id = 0, search_id = 0; gchar *search_text = NULL; EFilterRule *advanced_search = NULL; - GtkRadioAction *radio_action; - - shell_content = E_SHELL_CONTENT (book_shell_content); - book_shell_view = E_BOOK_SHELL_VIEW (e_shell_content_get_shell_view (shell_content)); e_book_shell_view_disable_searching (book_shell_view); - e_addressbook_view_get_search (addressbook_view, &filter_id, &search_id, &search_text, &advanced_search); - if (e_shell_content_get_filter_action (shell_content)) - e_shell_content_set_filter_value (shell_content, filter_id); - radio_action = e_shell_content_get_search_radio_action (shell_content); - gtk_radio_action_set_current_value (radio_action, search_id); - e_shell_content_set_search_text (shell_content, search_text ? search_text : ""); - e_shell_content_set_search_rule (shell_content, advanced_search); + + e_addressbook_view_get_search ( + addressbook_view, &filter_id, &search_id, + &search_text, &advanced_search); + + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_current_value (combo_box, filter_id); + + action = e_shell_searchbar_get_search_option (searchbar); + gtk_radio_action_set_current_value (action, search_id); + + e_shell_searchbar_set_search_text (searchbar, search_text); + + e_shell_view_set_search_rule (shell_view, advanced_search); + g_free (search_text); + if (advanced_search) g_object_unref (advanced_search); + e_book_shell_view_enable_searching (book_shell_view); } @@ -619,6 +635,21 @@ e_book_shell_content_set_preview_visible (EBookShellContent *book_shell_content, g_object_notify (G_OBJECT (book_shell_content), "preview-visible"); } +EShellSearchbar * +e_book_shell_content_get_searchbar (EBookShellContent *book_shell_content) +{ + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_BOOK_SHELL_CONTENT (book_shell_content), NULL); + + shell_content = E_SHELL_CONTENT (book_shell_content); + widget = e_shell_content_get_searchbar (shell_content); + + return E_SHELL_SEARCHBAR (widget); +} + void e_book_shell_content_clipboard_copy (EBookShellContent *book_shell_content) { diff --git a/modules/addressbook/e-book-shell-content.h b/modules/addressbook/e-book-shell-content.h index 5acfae46c8..62cc7bf80f 100644 --- a/modules/addressbook/e-book-shell-content.h +++ b/modules/addressbook/e-book-shell-content.h @@ -24,8 +24,9 @@ #include <libebook/e-contact.h> -#include "shell/e-shell-content.h" -#include "shell/e-shell-view.h" +#include <shell/e-shell-content.h> +#include <shell/e-shell-searchbar.h> +#include <shell/e-shell-view.h> #include "addressbook/gui/widgets/e-addressbook-view.h" #include "eab-composer-util.h" @@ -104,6 +105,9 @@ gboolean e_book_shell_content_get_preview_visible void e_book_shell_content_set_preview_visible (EBookShellContent *book_shell_content, gboolean preview_visible); +EShellSearchbar * + e_book_shell_content_get_searchbar + (EBookShellContent *book_shell_content); void e_book_shell_content_clipboard_copy (EBookShellContent *book_shell_content); diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index 5214f611d3..904b777c8b 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -973,7 +973,7 @@ static GtkRadioActionEntry contact_search_entries[] = { { "contact-search-advanced-hidden", NULL, - N_("Advanced search"), + N_("Advanced Search"), NULL, NULL, CONTACT_SEARCH_ADVANCED }, @@ -1051,14 +1051,14 @@ static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { void e_book_shell_view_actions_init (EBookShellView *book_shell_view) { + EBookShellContent *book_shell_content; EShellView *shell_view; EShellWindow *shell_window; - EBookShellContent *book_shell_content; + EShellSearchbar *searchbar; EABContactDisplay *contact_preview; GtkActionGroup *action_group; GConfBridge *bridge; GtkAction *action; - GtkRadioAction *radio_action; GObject *object; const gchar *key; @@ -1066,6 +1066,7 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) shell_window = e_shell_view_get_shell_window (shell_view); book_shell_content = book_shell_view->priv->book_shell_content; + searchbar = e_book_shell_content_get_searchbar (book_shell_content); contact_preview = e_book_shell_content_get_preview (book_shell_content); /* Contact Actions */ @@ -1088,11 +1089,14 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) G_N_ELEMENTS (contact_search_entries), -1, NULL, NULL); - /* Advanced Search action */ - radio_action = GTK_RADIO_ACTION (ACTION (CONTACT_SEARCH_ADVANCED_HIDDEN)); - e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action); - gtk_action_set_visible (GTK_ACTION (radio_action), FALSE); - gtk_radio_action_set_current_value (radio_action, CONTACT_SEARCH_NAME_CONTAINS); + /* Advanced Search Action */ + action = ACTION (CONTACT_SEARCH_ADVANCED_HIDDEN); + gtk_action_set_visible (action, FALSE); + e_shell_searchbar_set_search_option ( + searchbar, GTK_RADIO_ACTION (action)); + gtk_radio_action_set_current_value ( + GTK_RADIO_ACTION (action), + CONTACT_SEARCH_NAME_CONTAINS); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1156,9 +1160,11 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) void e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) { + EBookShellContent *book_shell_content; EShellView *shell_view; - EShellContent *shell_content; EShellWindow *shell_window; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; @@ -1166,7 +1172,6 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) gint ii; shell_view = E_SHELL_VIEW (book_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); action_group = ACTION_GROUP (CONTACTS_FILTER); @@ -1230,8 +1235,11 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) g_list_free (list); /* Use any action in the group; doesn't matter which. */ - e_shell_content_set_filter_action (shell_content, radio_action); + book_shell_content = book_shell_view->priv->book_shell_content; + searchbar = e_book_shell_content_get_searchbar (book_shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, radio_action); ii = CONTACT_FILTER_UNMATCHED; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); } diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h index f1b23c2cfb..c0fb2f09df 100644 --- a/modules/addressbook/e-book-shell-view-private.h +++ b/modules/addressbook/e-book-shell-view-private.h @@ -37,6 +37,7 @@ #include "e-util/e-file-utils.h" #include "e-util/gconf-bridge.h" #include "shell/e-shell-content.h" +#include "shell/e-shell-searchbar.h" #include "shell/e-shell-sidebar.h" #include "shell/e-shell-utils.h" #include "misc/e-popup-action.h" diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c index ebbf3e79d0..fa5e5bbe29 100644 --- a/modules/addressbook/e-book-shell-view.c +++ b/modules/addressbook/e-book-shell-view.c @@ -127,6 +127,8 @@ book_shell_view_execute_search (EShellView *shell_view) EBookShellContent *book_shell_content; EShellWindow *shell_window; EShellContent *shell_content; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkRadioAction *action; EAddressbookView *view; EAddressbookModel *model; @@ -141,25 +143,29 @@ book_shell_view_execute_search (EShellView *shell_view) if (priv->search_locked) return; - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + shell_content = e_shell_view_get_shell_content (shell_view); + + book_shell_content = E_BOOK_SHELL_CONTENT (shell_content); + searchbar = e_book_shell_content_get_searchbar (book_shell_content); + action = GTK_RADIO_ACTION (ACTION (CONTACT_SEARCH_ANY_FIELD_CONTAINS)); search_id = gtk_radio_action_get_current_value (action); if (search_id == CONTACT_SEARCH_ADVANCED) { - query = e_shell_content_get_search_rule_as_string (shell_content); + query = e_shell_view_get_search_query (shell_view); - if (!query) + if (query == NULL) query = g_strdup (""); /* internal pointer, no need to free it */ - advanced_search = e_shell_content_get_search_rule (shell_content); + advanced_search = e_shell_view_get_search_rule (shell_view); } else { const gchar *text; const gchar *format; GString *string; - text = e_shell_content_get_search_text (shell_content); + text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; @@ -194,7 +200,8 @@ book_shell_view_execute_search (EShellView *shell_view) } /* Apply selected filter. */ - filter_id = e_shell_content_get_filter_value (shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + filter_id = e_action_combo_box_get_current_value (combo_box); switch (filter_id) { case CONTACT_FILTER_ANY_CATEGORY: break; @@ -226,11 +233,11 @@ book_shell_view_execute_search (EShellView *shell_view) } /* Submit the query. */ - book_shell_content = E_BOOK_SHELL_CONTENT (shell_content); view = e_book_shell_content_get_current_view (book_shell_content); model = e_addressbook_view_get_model (view); e_addressbook_model_set_query (model, query); - e_addressbook_view_set_search (view, filter_id, search_id, search_text, advanced_search); + e_addressbook_view_set_search ( + view, filter_id, search_id, search_text, advanced_search); g_free (query); g_free (search_text); diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 0627f74dd6..fcebf59ca5 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -679,6 +679,21 @@ e_cal_shell_content_get_task_table (ECalShellContent *cal_shell_content) return E_CALENDAR_TABLE (cal_shell_content->priv->task_table); } +EShellSearchbar * +e_cal_shell_content_get_searchbar (ECalShellContent *cal_shell_content) +{ + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL); + + shell_content = E_SHELL_CONTENT (cal_shell_content); + widget = e_shell_content_get_searchbar (shell_content); + + return E_SHELL_SEARCHBAR (widget); +} + GalViewInstance * e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content) { diff --git a/modules/calendar/e-cal-shell-content.h b/modules/calendar/e-cal-shell-content.h index 3db7d33260..eae8bf3301 100644 --- a/modules/calendar/e-cal-shell-content.h +++ b/modules/calendar/e-cal-shell-content.h @@ -23,6 +23,7 @@ #define E_CAL_SHELL_CONTENT_H #include <shell/e-shell-content.h> +#include <shell/e-shell-searchbar.h> #include <shell/e-shell-view.h> #include <calendar/gui/e-memo-table.h> @@ -89,6 +90,9 @@ EMemoTable * e_cal_shell_content_get_memo_table (ECalShellContent *cal_shell_content); ECalendarTable *e_cal_shell_content_get_task_table (ECalShellContent *cal_shell_content); +EShellSearchbar * + e_cal_shell_content_get_searchbar + (ECalShellContent *cal_shell_content); GalViewInstance * e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content); diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index b0408b6b5a..148cc4a426 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1654,7 +1654,7 @@ static GtkRadioActionEntry calendar_search_entries[] = { { "calendar-search-advanced-hidden", NULL, - N_("Advanced search"), + N_("Advanced Search"), NULL, NULL, CALENDAR_SEARCH_ADVANCED }, @@ -1715,15 +1715,19 @@ static EPopupActionEntry lockdown_printing_popup_entries[] = { void e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) { + ECalShellContent *cal_shell_content; EShellView *shell_view; EShellWindow *shell_window; + EShellSearchbar *searchbar; GtkActionGroup *action_group; GtkAction *action; - GtkRadioAction *radio_action; shell_view = E_SHELL_VIEW (cal_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + cal_shell_content = cal_shell_view->priv->cal_shell_content; + searchbar = e_cal_shell_content_get_searchbar (cal_shell_content); + /* Calendar Actions */ action_group = ACTION_GROUP (CALENDAR); gtk_action_group_add_actions ( @@ -1741,11 +1745,14 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) G_N_ELEMENTS (calendar_search_entries), -1, NULL, NULL); - /* Advanced Search action */ - radio_action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ADVANCED_HIDDEN)); - e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action); - gtk_action_set_visible (GTK_ACTION (radio_action), FALSE); - gtk_radio_action_set_current_value (radio_action, CALENDAR_SEARCH_SUMMARY_CONTAINS); + /* Advanced Search Action */ + action = ACTION (CALENDAR_SEARCH_ADVANCED_HIDDEN); + gtk_action_set_visible (action, FALSE); + e_shell_searchbar_set_search_option ( + searchbar, GTK_RADIO_ACTION (action)); + gtk_radio_action_set_current_value ( + GTK_RADIO_ACTION (action), + CALENDAR_SEARCH_SUMMARY_CONTAINS); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1794,9 +1801,11 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) void e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) { - EShellContent *shell_content; - EShellWindow *shell_window; + ECalShellContent *cal_shell_content; EShellView *shell_view; + EShellWindow *shell_window; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; @@ -1804,7 +1813,6 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) gint ii; shell_view = E_SHELL_VIEW (cal_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); action_group = ACTION_GROUP (CALENDAR_FILTER); @@ -1868,11 +1876,14 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) g_list_free (list); /* Use any action in the group; doesn't matter which. */ - e_shell_content_set_filter_action (shell_content, radio_action); + cal_shell_content = cal_shell_view->priv->cal_shell_content; + searchbar = e_cal_shell_content_get_searchbar (cal_shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, radio_action); ii = CALENDAR_FILTER_UNMATCHED; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); } diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 47d734921c..262cd39246 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -59,6 +59,8 @@ cal_shell_view_execute_search (EShellView *shell_view) EShellWindow *shell_window; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GnomeCalendar *calendar; ECalendar *date_navigator; GtkRadioAction *action; @@ -74,11 +76,16 @@ cal_shell_view_execute_search (EShellView *shell_view) shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar); + + searchbar = e_cal_shell_content_get_searchbar (cal_shell_content); + action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); if (value == CALENDAR_SEARCH_ADVANCED) { - query = e_shell_content_get_search_rule_as_string (shell_content); + query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); @@ -87,7 +94,7 @@ cal_shell_view_execute_search (EShellView *shell_view) const gchar *text; GString *string; - text = e_shell_content_get_search_text (shell_content); + text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; @@ -123,7 +130,8 @@ cal_shell_view_execute_search (EShellView *shell_view) start_range = end_range = 0; /* Apply selected filter. */ - value = e_shell_content_get_filter_value (shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + value = e_action_combo_box_get_current_value (combo_box); switch (value) { case CALENDAR_FILTER_ANY_CATEGORY: break; @@ -186,7 +194,6 @@ cal_shell_view_execute_search (EShellView *shell_view) } } - cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar); date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar); if (range_search) { @@ -200,7 +207,6 @@ cal_shell_view_execute_search (EShellView *shell_view) } /* Submit the query. */ - cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); calendar = e_cal_shell_content_get_calendar (cal_shell_content); gnome_calendar_set_search_query ( calendar, query, range_search, start_range, end_range); diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index d3fe10f20b..4de685cd4b 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -727,6 +727,21 @@ e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content, g_object_notify (G_OBJECT (memo_shell_content), "preview-visible"); } +EShellSearchbar * +e_memo_shell_content_get_searchbar (EMemoShellContent *memo_shell_content) +{ + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL); + + shell_content = E_SHELL_CONTENT (memo_shell_content); + widget = e_shell_content_get_searchbar (shell_content); + + return E_SHELL_SEARCHBAR (widget); +} + GalViewInstance * e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content) { diff --git a/modules/calendar/e-memo-shell-content.h b/modules/calendar/e-memo-shell-content.h index 20c7db4df1..a923b27f0b 100644 --- a/modules/calendar/e-memo-shell-content.h +++ b/modules/calendar/e-memo-shell-content.h @@ -23,6 +23,7 @@ #define E_MEMO_SHELL_CONTENT_H #include <shell/e-shell-content.h> +#include <shell/e-shell-searchbar.h> #include <shell/e-shell-view.h> #include <calendar/gui/e-memo-table.h> @@ -88,6 +89,9 @@ gboolean e_memo_shell_content_get_preview_visible void e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content, gboolean preview_visible); +EShellSearchbar * + e_memo_shell_content_get_searchbar + (EMemoShellContent *memo_shell_content); GalViewInstance * e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content); diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 394d6091a4..baf90f5a73 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -819,7 +819,7 @@ static GtkRadioActionEntry memo_search_entries[] = { { "memo-search-advanced-hidden", NULL, - N_("Advanced search"), + N_("Advanced Search"), NULL, NULL, MEMO_SEARCH_ADVANCED }, @@ -897,14 +897,14 @@ static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { void e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) { + EMemoShellContent *memo_shell_content; EShellView *shell_view; EShellWindow *shell_window; - EMemoShellContent *memo_shell_content; + EShellSearchbar *searchbar; ECalComponentPreview *memo_preview; GtkActionGroup *action_group; GConfBridge *bridge; GtkAction *action; - GtkRadioAction *radio_action; GObject *object; const gchar *key; @@ -912,6 +912,7 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) shell_window = e_shell_view_get_shell_window (shell_view); memo_shell_content = memo_shell_view->priv->memo_shell_content; + searchbar = e_memo_shell_content_get_searchbar (memo_shell_content); memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content); /* Memo Actions */ @@ -934,11 +935,14 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) G_N_ELEMENTS (memo_search_entries), -1, NULL, NULL); - /* Advanced Search action */ - radio_action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ADVANCED_HIDDEN)); - e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action); - gtk_action_set_visible (GTK_ACTION (radio_action), FALSE); - gtk_radio_action_set_current_value (radio_action, MEMO_SEARCH_SUMMARY_CONTAINS); + /* Advanced Search Action */ + action = ACTION (MEMO_SEARCH_ADVANCED_HIDDEN); + gtk_action_set_visible (action, FALSE); + e_shell_searchbar_set_search_option ( + searchbar, GTK_RADIO_ACTION (action)); + gtk_radio_action_set_current_value ( + GTK_RADIO_ACTION (action), + MEMO_SEARCH_SUMMARY_CONTAINS); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1002,9 +1006,11 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) void e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) { - EShellContent *shell_content; - EShellWindow *shell_window; + EMemoShellContent *memo_shell_content; EShellView *shell_view; + EShellWindow *shell_window; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; @@ -1012,7 +1018,6 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) gint ii; shell_view = E_SHELL_VIEW (memo_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); action_group = ACTION_GROUP (MEMOS_FILTER); @@ -1076,8 +1081,11 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) g_list_free (list); /* Use any action in the group; doesn't matter which. */ - e_shell_content_set_filter_action (shell_content, radio_action); + memo_shell_content = memo_shell_view->priv->memo_shell_content; + searchbar = e_memo_shell_content_get_searchbar (memo_shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, radio_action); ii = MEMO_FILTER_UNMATCHED; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); } diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c index 206e50c961..29a82524c4 100644 --- a/modules/calendar/e-memo-shell-view.c +++ b/modules/calendar/e-memo-shell-view.c @@ -57,6 +57,8 @@ memo_shell_view_execute_search (EShellView *shell_view) EMemoShellContent *memo_shell_content; EShellWindow *shell_window; EShellContent *shell_content; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkRadioAction *action; ECalComponentPreview *memo_preview; EMemoTable *memo_table; @@ -67,11 +69,15 @@ memo_shell_view_execute_search (EShellView *shell_view) shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + searchbar = e_memo_shell_content_get_searchbar (memo_shell_content); + action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); if (value == MEMO_SEARCH_ADVANCED) { - query = e_shell_content_get_search_rule_as_string (shell_content); + query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); @@ -80,7 +86,7 @@ memo_shell_view_execute_search (EShellView *shell_view) const gchar *text; GString *string; - text = e_shell_content_get_search_text (shell_content); + text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; @@ -113,7 +119,8 @@ memo_shell_view_execute_search (EShellView *shell_view) } /* Apply selected filter. */ - value = e_shell_content_get_filter_value (shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + value = e_action_combo_box_get_current_value (combo_box); switch (value) { case MEMO_FILTER_ANY_CATEGORY: break; @@ -143,7 +150,6 @@ memo_shell_view_execute_search (EShellView *shell_view) } /* Submit the query. */ - memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); model = e_memo_table_get_model (memo_table); e_cal_model_set_search_query (model, query); diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index c033d6e489..4692e7bf7e 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -750,6 +750,21 @@ e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content, g_object_notify (G_OBJECT (task_shell_content), "preview-visible"); } +EShellSearchbar * +e_task_shell_content_get_searchbar (ETaskShellContent *task_shell_content) +{ + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL); + + shell_content = E_SHELL_CONTENT (task_shell_content); + widget = e_shell_content_get_searchbar (shell_content); + + return E_SHELL_SEARCHBAR (widget); +} + GalViewInstance * e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content) { diff --git a/modules/calendar/e-task-shell-content.h b/modules/calendar/e-task-shell-content.h index e5bdecd8c0..971d46ad95 100644 --- a/modules/calendar/e-task-shell-content.h +++ b/modules/calendar/e-task-shell-content.h @@ -23,6 +23,7 @@ #define E_TASK_SHELL_CONTENT_H #include <shell/e-shell-content.h> +#include <shell/e-shell-searchbar.h> #include <shell/e-shell-view.h> #include <calendar/gui/e-cal-model.h> @@ -92,6 +93,9 @@ gboolean e_task_shell_content_get_preview_visible void e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content, gboolean preview_visible); +EShellSearchbar * + e_task_shell_content_get_searchbar + (ETaskShellContent *task_shell_content); GalViewInstance * e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content); diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 6e79c23395..8e28b55863 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -1018,7 +1018,7 @@ static GtkRadioActionEntry task_search_entries[] = { { "task-search-advanced-hidden", NULL, - N_("Advanced search"), + N_("Advanced Search"), NULL, NULL, TASK_SEARCH_ADVANCED }, @@ -1096,14 +1096,14 @@ static EPopupActionEntry lockdown_save_to_disk_popup_entries[] = { void e_task_shell_view_actions_init (ETaskShellView *task_shell_view) { + ETaskShellContent *task_shell_content; EShellView *shell_view; EShellWindow *shell_window; - ETaskShellContent *task_shell_content; + EShellSearchbar *searchbar; ECalComponentPreview *task_preview; GtkActionGroup *action_group; GConfBridge *bridge; GtkAction *action; - GtkRadioAction *radio_action; GObject *object; const gchar *key; @@ -1111,6 +1111,7 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) shell_window = e_shell_view_get_shell_window (shell_view); task_shell_content = task_shell_view->priv->task_shell_content; + searchbar = e_task_shell_content_get_searchbar (task_shell_content); task_preview = e_task_shell_content_get_task_preview (task_shell_content); /* Task Actions */ @@ -1133,11 +1134,14 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) G_N_ELEMENTS (task_search_entries), -1, NULL, NULL); - /* Advanced Search action */ - radio_action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ADVANCED_HIDDEN)); - e_shell_content_set_search_radio_action (e_shell_view_get_shell_content (shell_view), radio_action); - gtk_action_set_visible (GTK_ACTION (radio_action), FALSE); - gtk_radio_action_set_current_value (radio_action, TASK_SEARCH_SUMMARY_CONTAINS); + /* Advanced Search Action */ + action = ACTION (TASK_SEARCH_ADVANCED_HIDDEN); + gtk_action_set_visible (action, FALSE); + e_shell_searchbar_set_search_option ( + searchbar, GTK_RADIO_ACTION (action)); + gtk_radio_action_set_current_value ( + GTK_RADIO_ACTION (action), + TASK_SEARCH_SUMMARY_CONTAINS); /* Lockdown Printing Actions */ action_group = ACTION_GROUP (LOCKDOWN_PRINTING); @@ -1201,9 +1205,11 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) void e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) { - EShellContent *shell_content; - EShellWindow *shell_window; + ETaskShellContent *task_shell_content; EShellView *shell_view; + EShellWindow *shell_window; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GList *list, *iter; @@ -1211,7 +1217,6 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) gint ii; shell_view = E_SHELL_VIEW (task_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); action_group = ACTION_GROUP (TASKS_FILTER); @@ -1275,11 +1280,14 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) g_list_free (list); /* Use any action in the group; doesn't matter which. */ - e_shell_content_set_filter_action (shell_content, radio_action); + task_shell_content = task_shell_view->priv->task_shell_content; + searchbar = e_task_shell_content_get_searchbar (task_shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, radio_action); ii = TASK_FILTER_UNMATCHED; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); ii = TASK_FILTER_TASKS_WITH_ATTACHMENTS; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); } diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index 9558eb77c0..a481356690 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -96,6 +96,8 @@ task_shell_view_execute_search (EShellView *shell_view) ETaskShellContent *task_shell_content; EShellWindow *shell_window; EShellContent *shell_content; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkRadioAction *action; ECalComponentPreview *task_preview; ECalendarTable *task_table; @@ -107,13 +109,17 @@ task_shell_view_execute_search (EShellView *shell_view) gchar *temp; gint value; - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); + shell_content = e_shell_view_get_shell_content (shell_view); + + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + searchbar = e_task_shell_content_get_searchbar (task_shell_content); + action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); if (value == TASK_SEARCH_ADVANCED) { - query = e_shell_content_get_search_rule_as_string (shell_content); + query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); @@ -122,7 +128,7 @@ task_shell_view_execute_search (EShellView *shell_view) const gchar *text; GString *string; - text = e_shell_content_get_search_text (shell_content); + text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { text = ""; @@ -155,7 +161,8 @@ task_shell_view_execute_search (EShellView *shell_view) } /* Apply selected filter. */ - value = e_shell_content_get_filter_value (shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + value = e_action_combo_box_get_current_value (combo_box); switch (value) { case TASK_FILTER_ANY_CATEGORY: break; diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index f9b0b7da80..a1d8a40d82 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -31,7 +31,6 @@ #include "widgets/menus/gal-view-instance.h" #include "widgets/misc/e-paned.h" -#include "em-search-context.h" #include "em-utils.h" #include "mail-config.h" #include "mail-ops.h" @@ -610,7 +609,6 @@ mail_shell_content_class_init (EMailShellContentClass *class) object_class->constructed = mail_shell_content_constructed; shell_content_class = E_SHELL_CONTENT_CLASS (class); - shell_content_class->new_search_context = em_search_context_new; shell_content_class->check_state = mail_shell_content_check_state; g_object_class_install_property ( @@ -758,6 +756,21 @@ e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, g_object_notify (G_OBJECT (mail_shell_content), "preview-visible"); } +EShellSearchbar * +e_mail_shell_content_get_searchbar (EMailShellContent *mail_shell_content) +{ + EShellContent *shell_content; + GtkWidget *widget; + + g_return_val_if_fail ( + E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL); + + shell_content = E_SHELL_CONTENT (mail_shell_content); + widget = e_shell_content_get_searchbar (shell_content); + + return E_SHELL_SEARCHBAR (widget); +} + gboolean e_mail_shell_content_get_show_deleted (EMailShellContent *mail_shell_content) { diff --git a/modules/mail/e-mail-shell-content.h b/modules/mail/e-mail-shell-content.h index c11323b5f1..69a1fdc397 100644 --- a/modules/mail/e-mail-shell-content.h +++ b/modules/mail/e-mail-shell-content.h @@ -23,6 +23,7 @@ #define E_MAIL_SHELL_CONTENT_H #include <shell/e-shell-content.h> +#include <shell/e-shell-searchbar.h> #include <shell/e-shell-view.h> #include <mail/em-format-html-display.h> @@ -73,6 +74,9 @@ gboolean e_mail_shell_content_get_preview_visible void e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, gboolean preview_visible); +EShellSearchbar * + e_mail_shell_content_get_searchbar + (EMailShellContent *mail_shell_content); gboolean e_mail_shell_content_get_show_deleted (EMailShellContent *mail_shell_content); void e_mail_shell_content_set_show_deleted diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index f300ec0c92..103463b586 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -80,9 +80,10 @@ static void action_mail_create_search_folder_cb (GtkAction *action, EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EMailReader *reader; EShellView *shell_view; - EShellContent *shell_content; + EShellSearchbar *searchbar; EFilterRule *search_rule; EMVFolderRule *vfolder_rule; const gchar *folder_uri; @@ -92,16 +93,17 @@ action_mail_create_search_folder_cb (GtkAction *action, vfolder_load_storage (); shell_view = E_SHELL_VIEW (mail_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); - search_rule = e_shell_content_get_search_rule (shell_content); - search_text = e_shell_content_get_search_text (shell_content); - + search_rule = e_shell_view_get_search_rule (shell_view); g_return_if_fail (search_rule != NULL); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); + search_text = e_shell_searchbar_get_search_text (searchbar); + if (search_text == NULL || *search_text == '\0') search_text = "''"; - reader = E_MAIL_READER (shell_content); + reader = E_MAIL_READER (mail_shell_content); folder_uri = e_mail_reader_get_folder_uri (reader); search_rule = vfolder_clone_rule (search_rule); @@ -1427,7 +1429,7 @@ static GtkRadioActionEntry mail_search_entries[] = { { "mail-search-advanced-hidden", NULL, - N_("Advanced search"), + N_("Advanced Search"), NULL, NULL, MAIL_SEARCH_ADVANCED }, @@ -1502,11 +1504,13 @@ static GtkRadioActionEntry mail_scope_entries[] = { void e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EShellView *shell_view; EShellWindow *shell_window; - EShellContent *shell_content; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; - GtkRadioAction *radio_action; + GtkAction *action; GConfBridge *bridge; GObject *object; const gchar *key; @@ -1515,7 +1519,9 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); /* Mail Actions */ action_group = ACTION_GROUP (MAIL); @@ -1542,15 +1548,19 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) MAIL_SCOPE_CURRENT_FOLDER, G_CALLBACK (action_search_scope_cb), mail_shell_view); - radio_action = GTK_RADIO_ACTION (ACTION (MAIL_SCOPE_ALL_ACCOUNTS)); - e_shell_content_set_scope_action (shell_content, radio_action); - e_shell_content_set_scope_visible (shell_content, TRUE); + action = ACTION (MAIL_SCOPE_ALL_ACCOUNTS); + combo_box = e_shell_searchbar_get_scope_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, GTK_RADIO_ACTION (action)); + e_shell_searchbar_set_scope_visible (searchbar, TRUE); - /* Advanced Search action */ - radio_action = GTK_RADIO_ACTION (ACTION (MAIL_SEARCH_ADVANCED_HIDDEN)); - e_shell_content_set_search_radio_action (shell_content, radio_action); - gtk_action_set_visible (GTK_ACTION (radio_action), FALSE); - gtk_radio_action_set_current_value (radio_action, MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN); + /* Advanced Search Action */ + action = ACTION (MAIL_SEARCH_ADVANCED_HIDDEN); + gtk_action_set_visible (action, FALSE); + e_shell_searchbar_set_search_option ( + searchbar, GTK_RADIO_ACTION (action)); + gtk_radio_action_set_current_value ( + GTK_RADIO_ACTION (action), + MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN); /* Bind GObject properties for GConf keys. */ @@ -1588,7 +1598,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) e_mutual_binding_new ( ACTION (MAIL_PREVIEW), "active", - shell_content, "preview-visible"); + mail_shell_content, "preview-visible"); e_binding_new ( ACTION (MAIL_PREVIEW), "active", @@ -1601,7 +1611,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) /* XXX The boolean sense of the GConf key is the inverse of * the menu item, so we have to maintain two properties. */ e_mutual_binding_new_with_negation ( - shell_content, "show-deleted", + mail_shell_content, "show-deleted", ACTION (MAIL_HIDE_DELETED), "active"); /* Keep the sensitivity of "Create Search Folder from Search" @@ -1772,11 +1782,13 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) void e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view) { + EMailShellContent *mail_shell_content; EShell *shell; - EShellContent *shell_content; - EShellSettings *shell_settings; - EShellWindow *shell_window; EShellView *shell_view; + EShellWindow *shell_window; + EShellSettings *shell_settings; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; GtkActionGroup *action_group; GtkRadioAction *radio_action; GtkTreeModel *tree_model; @@ -1789,7 +1801,6 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); shell_view = E_SHELL_VIEW (mail_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); @@ -1849,13 +1860,16 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view) } /* Use any action in the group; doesn't matter which. */ - e_shell_content_set_filter_action (shell_content, radio_action); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + e_action_combo_box_set_action (combo_box, radio_action); ii = MAIL_FILTER_UNREAD_MESSAGES; - e_shell_content_add_filter_separator_after (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); ii = MAIL_FILTER_READ_MESSAGES; - e_shell_content_add_filter_separator_before (shell_content, ii); + e_action_combo_box_add_separator_after (combo_box, ii); g_object_unref (tree_model); } diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index c152b84817..f1e9805752 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -646,7 +646,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) /* Populate built-in rules for search entry popup menu. * Keep the assertions, please. If the conditions aren't * met we're going to crash anyway, just more mysteriously. */ - context = e_shell_content_get_search_context (shell_content); + context = E_SHELL_VIEW_GET_CLASS (shell_view)->search_context; source = E_FILTER_SOURCE_DEMAND; while ((rule = e_rule_context_next_rule (context, rule, source))) { g_assert (ii < MAIL_NUM_SEARCH_RULES); @@ -696,8 +696,8 @@ e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view) void e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) { - EShellView *shell_view; - EShellContent *shell_content; + EMailShellContent *mail_shell_content; + EShellSearchbar *searchbar; EMailReader *reader; const gchar *folder_uri; gchar *group_name; @@ -706,17 +706,17 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_content = e_shell_view_get_shell_content (shell_view); + mail_shell_content = mail_shell_view->priv->mail_shell_content; + searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); - reader = E_MAIL_READER (shell_content); + reader = E_MAIL_READER (mail_shell_content); folder_uri = e_mail_reader_get_folder_uri (reader); if (folder_uri == NULL) return; group_name = g_strdup_printf ("Folder %s", folder_uri); - e_shell_content_restore_state (shell_content, group_name); + e_shell_searchbar_restore_state (searchbar, group_name); g_free (group_name); } diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index bd99da5a1e..44a02eddbd 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -51,6 +51,7 @@ #include "em-folder-properties.h" #include "em-folder-selector.h" #include "em-folder-utils.h" +#include "em-search-context.h" #include "em-subscribe-editor.h" #include "em-utils.h" #include "mail-autofilter.h" diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 7e1d00393d..de81e131c5 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -87,12 +87,14 @@ static void mail_shell_view_execute_search (EShellView *shell_view) { EMailShellViewPrivate *priv; + EMailShellContent *mail_shell_content; EShell *shell; EShellWindow *shell_window; EShellContent *shell_content; EShellSettings *shell_settings; + EShellSearchbar *searchbar; + EActionComboBox *combo_box; EMFormatHTMLDisplay *html_display; - EMailShellContent *mail_shell_content; GtkWidget *message_list; EFilterRule *rule; EMailReader *reader; @@ -121,6 +123,7 @@ mail_shell_view_execute_search (EShellView *shell_view) shell_settings = e_shell_get_shell_settings (shell); mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); + searchbar = e_mail_shell_content_get_searchbar (mail_shell_content); reader = E_MAIL_READER (shell_content); folder = e_mail_reader_get_folder (reader); @@ -137,7 +140,7 @@ mail_shell_view_execute_search (EShellView *shell_view) key_file = e_shell_view_get_state_key_file (shell_view); key = STATE_KEY_SEARCH_TEXT; - string = e_shell_content_get_search_text (shell_content); + string = e_shell_searchbar_get_search_text (searchbar); group_name = g_strdup_printf ("Folder %s", folder_uri); if (string != NULL && *string != '\0') @@ -158,12 +161,12 @@ mail_shell_view_execute_search (EShellView *shell_view) action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN); value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); - text = e_shell_content_get_search_text (shell_content); + text = e_shell_searchbar_get_search_text (searchbar); if (value == MAIL_SEARCH_ADVANCED || text == NULL || *text == '\0') { if (value != MAIL_SEARCH_ADVANCED) - e_shell_content_set_search_rule (shell_content, NULL); + e_shell_view_set_search_rule (shell_view, NULL); - query = e_shell_content_get_search_rule_as_string (shell_content); + query = e_shell_view_get_search_query (shell_view); if (!query) query = g_strdup (""); @@ -177,9 +180,9 @@ mail_shell_view_execute_search (EShellView *shell_view) g_return_if_fail (value >= 0 && value < MAIL_NUM_SEARCH_RULES); rule = priv->search_rules[value]; - /* Set the search rule in EShellContent so that "Create + /* Set the search rule in EShellView so that "Create * Search Folder from Search" works for quick searches. */ - e_shell_content_set_search_rule (shell_content, rule); + e_shell_view_set_search_rule (shell_view, rule); for (iter = rule->parts; iter != NULL; iter = iter->next) { EFilterPart *part = iter->data; @@ -220,7 +223,8 @@ filter: /* Apply selected filter. */ - value = e_shell_content_get_filter_value (shell_content); + combo_box = e_shell_searchbar_get_filter_combo_box (searchbar); + value = e_action_combo_box_get_current_value (combo_box); switch (value) { case MAIL_FILTER_ALL_MESSAGES: break; @@ -593,6 +597,7 @@ mail_shell_view_class_init (EMailShellViewClass *class, shell_view_class->icon_name = "evolution-mail"; shell_view_class->ui_definition = "evolution-mail.ui"; shell_view_class->ui_manager_id = "org.gnome.evolution.mail"; + shell_view_class->search_context_type = EM_SEARCH_TYPE_CONTEXT; shell_view_class->search_options = "/mail-search-options"; shell_view_class->search_rules = "searchtypes.xml"; shell_view_class->new_shell_content = e_mail_shell_content_new; |