aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-browser.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-folder-browser.c')
-rw-r--r--mail/em-folder-browser.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 0574de0bcb..66f76c6548 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -1011,7 +1011,6 @@ struct _setup_msg {
CamelFolder *folder;
CamelOperation *cancel;
- gchar *query;
GList *sources_uri;
GList *sources_folder;
};
@@ -1033,8 +1032,6 @@ vfolder_setup_exec(struct _setup_msg *m)
d(printf("Setting up Search Folder: %s\n", m->folder->full_name));
- camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query);
-
l = m->sources_uri;
while (l) {
d(printf(" Adding uri: %s\n", (gchar *)l->data));
@@ -1077,7 +1074,6 @@ vfolder_setup_free (struct _setup_msg *m)
GList *l;
camel_object_unref(m->folder);
- g_free(m->query);
l = m->sources_uri;
while (l) {
@@ -1104,7 +1100,7 @@ static MailMsgInfo vfolder_setup_info = {
/* sources_uri should be camel uri's */
static gint
-vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList *sources_folder, CamelOperation *cancel)
+vfolder_setup (CamelFolder *folder, GList *sources_uri, GList *sources_folder, CamelOperation *cancel)
{
struct _setup_msg *m;
gint id;
@@ -1112,7 +1108,6 @@ vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList
m = mail_msg_new(&vfolder_setup_info);
m->folder = folder;
camel_object_ref(folder);
- m->query = g_strdup(query);
m->sources_uri = sources_uri;
m->sources_folder = sources_folder;
@@ -1199,14 +1194,23 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
efb->account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
/* Set the search expression */
+ camel_vee_folder_set_expression (efb->account_search_vf, search_word);
+
efb->account_search_cancel = camel_operation_new (NULL, NULL);
- vfolder_setup ((CamelFolder *)efb->account_search_vf, search_word, NULL, folder_list_account, efb->account_search_cancel);
+ vfolder_setup ((CamelFolder *)efb->account_search_vf, NULL, folder_list_account, efb->account_search_cancel);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->account_search_vf);
emfb_set_search_folder (emfv, (CamelFolder *)efb->account_search_vf, folder_uri);
g_free (folder_uri);
g_free (storeuri);
} else {
+ /* cancel previous filling first, if under way */
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
+
/* Reuse the existing search folder */
camel_vee_folder_set_expression((CamelVeeFolder *)efb->account_search_vf, search_word);
}
@@ -1281,8 +1285,10 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
l = l->next;
}
+ camel_vee_folder_set_expression (efb->all_account_search_vf, search_word);
+
efb->account_search_cancel = camel_operation_new (NULL, NULL);
- vfolder_setup ((CamelFolder *)efb->all_account_search_vf, search_word, NULL, folder_list, efb->account_search_cancel);
+ vfolder_setup ((CamelFolder *)efb->all_account_search_vf, NULL, folder_list, efb->account_search_cancel);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->all_account_search_vf);
@@ -1290,6 +1296,13 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
g_free (folder_uri);
g_free (storeuri);
} else {
+ /* cancel previous filling first, if under way */
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
+
/* Reuse the existing search folder */
camel_vee_folder_set_expression((CamelVeeFolder *)efb->all_account_search_vf, search_word);
}