aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-window-actions.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 /shell/e-shell-window-actions.c
parenta1efb837566cdac798cd8777dd34e06e9782cf61 (diff)
downloadgsoc2013-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 'shell/e-shell-window-actions.c')
-rw-r--r--shell/e-shell-window-actions.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 03fa5379eb..4483347beb 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -705,7 +705,6 @@ action_custom_rule_cb (GtkAction *action,
{
EFilterRule *rule;
EShellView *shell_view;
- EShellContent *shell_content;
const gchar *view_name;
rule = g_object_get_data (G_OBJECT (action), "rule");
@@ -713,14 +712,11 @@ action_custom_rule_cb (GtkAction *action,
view_name = e_shell_window_get_active_view (shell_window);
shell_view = e_shell_window_get_shell_view (shell_window, view_name);
- shell_content = e_shell_view_get_shell_content (shell_view);
rule = g_object_get_data (G_OBJECT (action), "rule");
g_return_if_fail (E_IS_FILTER_RULE (rule));
- e_shell_content_set_search_rule (shell_content, rule);
-
- e_shell_view_execute_search (shell_view);
+ e_shell_view_custom_search (shell_view, rule);
}
/**
@@ -1044,25 +1040,12 @@ action_search_clear_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShellView *shell_view;
- EShellContent *shell_content;
- GtkRadioAction *search_action;
const gchar *view_name;
view_name = e_shell_window_get_active_view (shell_window);
shell_view = e_shell_window_get_shell_view (shell_window, view_name);
- shell_content = e_shell_view_get_shell_content (shell_view);
-
- e_shell_content_set_search_rule (shell_content, NULL);
- e_shell_content_set_search_text (shell_content, NULL);
-
- /* change from Advanced Search to the first one, so filling a text will do something */
- search_action = e_shell_content_get_search_radio_action (shell_content);
- if (search_action && gtk_radio_action_get_current_value (search_action) == -1)
- gtk_radio_action_set_current_value (search_action, 0);
-
- e_shell_view_execute_search (shell_view);
- e_shell_window_update_search_menu (shell_window);
+ e_shell_view_clear_search (shell_view);
}
/**
@@ -1125,20 +1108,11 @@ static void
action_search_quick_cb (GtkAction *action,
EShellWindow *shell_window)
{
- EShellContent *shell_content;
EShellView *shell_view;
- GtkRadioAction *radio_action;
const gchar *view_name;
view_name = e_shell_window_get_active_view (shell_window);
shell_view = e_shell_window_get_shell_view (shell_window, view_name);
- shell_content = e_shell_view_get_shell_content (shell_view);
-
- radio_action = e_shell_content_get_search_radio_action (shell_content);
- if (radio_action && gtk_radio_action_get_current_value (radio_action) == -1) {
- /* change Advanced Search to a default search type automatically */
- gtk_radio_action_set_current_value (radio_action, 0);
- }
e_shell_view_execute_search (shell_view);
}
@@ -2213,7 +2187,6 @@ e_shell_window_update_view_menu (EShellWindow *shell_window)
void
e_shell_window_update_search_menu (EShellWindow *shell_window)
{
- EShellContent *shell_content;
EShellView *shell_view;
EShellViewClass *shell_view_class;
ERuleContext *context;
@@ -2237,15 +2210,14 @@ e_shell_window_update_search_menu (EShellWindow *shell_window)
* Without this we would crash at E_SHELL_VIEW_GET_CLASS(). */
g_return_if_fail (shell_view != NULL);
- shell_content = e_shell_view_get_shell_content (shell_view);
- context = e_shell_content_get_search_context (shell_content);
shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ context = shell_view_class->search_context;
source = E_FILTER_SOURCE_INCOMING;
/* Update sensitivity of search actions. */
- sensitive = (e_shell_content_get_search_rule (shell_content) != NULL);
+ sensitive = (e_shell_view_get_search_rule (shell_view) != NULL);
gtk_action_set_sensitive (ACTION (SEARCH_CLEAR), sensitive);
gtk_action_set_sensitive (ACTION (SEARCH_SAVE), sensitive);