From 31e449ebed6a136e643ec3bf4c0d9f1b3fc87897 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 3 Feb 2010 10:01:58 -0500 Subject: Implement account-wide search scope in mail. Also, let EShellSearchbar handle search state persistence. --- modules/calendar/e-cal-shell-view-actions.c | 26 ++++++++++---------------- modules/calendar/e-memo-shell-view-actions.c | 26 ++++++++++---------------- modules/calendar/e-task-shell-view-actions.c | 26 ++++++++++---------------- 3 files changed, 30 insertions(+), 48 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 19fc7e6c53..03a6eb6bd3 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -1222,14 +1222,6 @@ action_gal_save_custom_view_cb (GtkAction *action, gal_view_instance_save_as (view_instance); } -static void -action_search_filter_cb (GtkRadioAction *action, - GtkRadioAction *current, - EShellView *shell_view) -{ - e_shell_view_execute_search (shell_view); -} - static GtkActionEntry calendar_entries[] = { { "calendar-copy", @@ -1719,9 +1711,6 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view) 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); @@ -1784,13 +1773,13 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) action_group = ACTION_GROUP (CALENDAR_FILTER); e_action_group_remove_all_actions (action_group); - /* Add the standard filter actions. */ + /* Add the standard filter actions. No callback is needed + * because changes in the EActionComboBox are detected and + * handled by EShellSearchbar. */ gtk_action_group_add_radio_actions ( action_group, calendar_filter_entries, G_N_ELEMENTS (calendar_filter_entries), - CALENDAR_FILTER_ANY_CATEGORY, - G_CALLBACK (action_search_filter_cb), - cal_shell_view); + CALENDAR_FILTER_ANY_CATEGORY, NULL, NULL); /* Retrieve the radio group from an action we just added. */ list = gtk_action_group_list_actions (action_group); @@ -1841,10 +1830,13 @@ 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. */ 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_shell_view_block_execute_search (shell_view); + + /* Use any action in the group; doesn't matter which. */ e_action_combo_box_set_action (combo_box, radio_action); ii = CALENDAR_FILTER_UNMATCHED; @@ -1852,4 +1844,6 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view) ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS; e_action_combo_box_add_separator_after (combo_box, ii); + + e_shell_view_unblock_execute_search (shell_view); } diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 24aced8528..f53b8ff406 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -560,14 +560,6 @@ action_memo_view_cb (GtkRadioAction *action, gtk_orientable_set_orientation (orientable, orientation); } -static void -action_search_filter_cb (GtkRadioAction *action, - GtkRadioAction *current, - EShellView *shell_view) -{ - e_shell_view_execute_search (shell_view); -} - static GtkActionEntry memo_entries[] = { { "memo-delete", @@ -892,9 +884,6 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) 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); @@ -967,13 +956,13 @@ e_memo_shell_view_update_search_filter (EMemoShellView *memo_shell_view) action_group = ACTION_GROUP (MEMOS_FILTER); e_action_group_remove_all_actions (action_group); - /* Add the standard filter actions. */ + /* Add the standard filter actions. No callback is needed + * because changes in the EActionComboBox are detected and + * handled by EShellSearchbar. */ gtk_action_group_add_radio_actions ( action_group, memo_filter_entries, G_N_ELEMENTS (memo_filter_entries), - MEMO_FILTER_ANY_CATEGORY, - G_CALLBACK (action_search_filter_cb), - memo_shell_view); + MEMO_FILTER_ANY_CATEGORY, NULL, NULL); /* Retrieve the radio group from an action we just added. */ list = gtk_action_group_list_actions (action_group); @@ -1024,12 +1013,17 @@ 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. */ 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_shell_view_block_execute_search (shell_view); + + /* Use any action in the group; doesn't matter which. */ e_action_combo_box_set_action (combo_box, radio_action); ii = MEMO_FILTER_UNMATCHED; e_action_combo_box_add_separator_after (combo_box, ii); + + e_shell_view_unblock_execute_search (shell_view); } diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index c18882dd2b..55873dd9f9 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -42,14 +42,6 @@ action_gal_save_custom_view_cb (GtkAction *action, gal_view_instance_save_as (view_instance); } -static void -action_search_filter_cb (GtkRadioAction *action, - GtkRadioAction *current, - EShellView *shell_view) -{ - e_shell_view_execute_search (shell_view); -} - static void action_task_assign_cb (GtkAction *action, ETaskShellView *task_shell_view) @@ -1091,9 +1083,6 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) 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); @@ -1166,13 +1155,13 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) action_group = ACTION_GROUP (TASKS_FILTER); e_action_group_remove_all_actions (action_group); - /* Add the standard filter actions. */ + /* Add the standard filter actions. No callback is needed + * because changes in the EActionComboBox are detected and + * handled by EShellSearchbar. */ gtk_action_group_add_radio_actions ( action_group, task_filter_entries, G_N_ELEMENTS (task_filter_entries), - TASK_FILTER_ANY_CATEGORY, - G_CALLBACK (action_search_filter_cb), - task_shell_view); + TASK_FILTER_ANY_CATEGORY, NULL, NULL); /* Retrieve the radio group from an action we just added. */ list = gtk_action_group_list_actions (action_group); @@ -1223,10 +1212,13 @@ 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. */ 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_shell_view_block_execute_search (shell_view); + + /* Use any action in the group; doesn't matter which. */ e_action_combo_box_set_action (combo_box, radio_action); ii = TASK_FILTER_UNMATCHED; @@ -1234,4 +1226,6 @@ e_task_shell_view_update_search_filter (ETaskShellView *task_shell_view) ii = TASK_FILTER_TASKS_WITH_ATTACHMENTS; e_action_combo_box_add_separator_after (combo_box, ii); + + e_shell_view_unblock_execute_search (shell_view); } -- cgit v1.2.3