aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook/e-book-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-12-19 07:23:48 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-12-19 11:38:00 +0800
commit4cbbdedf522a6ac10df93a128bbf25f67173d66e (patch)
treefab7bf95e0927e4fa98c58a659e310afff7153ee /modules/addressbook/e-book-shell-content.c
parenta1efb837566cdac798cd8777dd34e06e9782cf61 (diff)
downloadgsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar
gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.gz
gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.bz2
gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.lz
gsoc2013-evolution-4cbbdedf522a6ac10df93a128bbf25f67173d66e.tar.xz
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/addressbook/e-book-shell-content.c')
-rw-r--r--modules/addressbook/e-book-shell-content.c55
1 files changed, 43 insertions, 12 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)
{