diff options
author | Milan Crha <mcrha@redhat.com> | 2009-11-19 22:40:50 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-11-19 22:40:50 +0800 |
commit | aa813bd7cadffa0110ddeeecd2b8df9d367db6e1 (patch) | |
tree | 8580dce61f4952b17225fa5262339432db092e4c /modules/mail/e-mail-shell-view.c | |
parent | 72861cffee5a3f9a5434fe0a94c7ec60beec1cc2 (diff) | |
download | gsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.tar.gz gsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.tar.zst gsoc2013-evolution-aa813bd7cadffa0110ddeeecd2b8df9d367db6e1.zip |
Bug #579599 - Let the Advanced Search work again
Diffstat (limited to 'modules/mail/e-mail-shell-view.c')
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 1241716340..895bd33903 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -94,7 +94,6 @@ mail_shell_view_execute_search (EShellView *shell_view) EMailShellContent *mail_shell_content; MessageList *message_list; EFilterRule *rule; - EFilterRule *search_rule; EMailReader *reader; CamelFolder *folder; GtkAction *action; @@ -156,20 +155,29 @@ mail_shell_view_execute_search (EShellView *shell_view) model = e_shell_settings_get_object ( shell_settings, "mail-label-list-store"); + 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); - if (text == NULL || *text == '\0') { - query = g_strdup (""); + if (value == MAIL_SEARCH_ADVANCED || text == NULL || *text == '\0') { + query = e_shell_content_get_search_rule_as_string (shell_content); + + if (!query) + query = g_strdup (""); + goto filter; } /* Replace variables in the selected rule with the * current search text and extract a query string. */ - action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN); - value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); 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 + * Search Folder from Search" works for quick searches. */ + e_shell_content_set_search_rule (shell_content, rule); + for (iter = rule->parts; iter != NULL; iter = iter->next) { EFilterPart *part = iter->data; EFilterElement *element = NULL; @@ -337,18 +345,6 @@ filter: break; } - search_rule = e_shell_content_get_search_rule (shell_content); - if (search_rule != NULL) { - string = g_string_sized_new (1024); - e_filter_rule_build_code (search_rule, string); - temp = g_strconcat ("(and", string->str, query, ")", NULL); - - g_free (query); - query = temp; - - g_string_free (string, TRUE); - } - message_list_set_search (message_list, query); e_mail_shell_content_set_search_strings ( |