aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Jacob <jjohnny@src.gnome.org>2008-01-25 20:34:03 +0800
committerJohnny Jacob <jjohnny@src.gnome.org>2008-01-25 20:34:03 +0800
commit03ee742015a029c1ac57a121752ec0ff06fcb7fb (patch)
treef435028bc08570ee6fcaa1aff90c84e83c8e0ba4
parent6459ad63f084fbfd761b3691b8a7934b92f4588a (diff)
downloadgsoc2013-evolution-03ee742015a029c1ac57a121752ec0ff06fcb7fb.tar.gz
gsoc2013-evolution-03ee742015a029c1ac57a121752ec0ff06fcb7fb.tar.zst
gsoc2013-evolution-03ee742015a029c1ac57a121752ec0ff06fcb7fb.zip
Fix for 467581 : wrap a/c searches in a camel-op for better cancellation.
svn path=/trunk/; revision=34892
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-folder-browser.c32
-rw-r--r--widgets/misc/ChangeLog5
-rw-r--r--widgets/misc/e-filter-bar.c2
-rw-r--r--widgets/misc/e-filter-bar.h3
5 files changed, 43 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 55d16fc302..003db2d774 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-25 Johnny Jacob <jjohnny@novell.com>
+
+ ** Fix for #467581.
+
+ * em-folder-browser.c : Don't cancel all threads for a vfolder
+ based search (all/account search). Introduced cameloperation for
+ this and cancel it on clear.
+
2008-01-24 Milan Crha <mcrha@redhat.com>
** Partial fix for bug #395939
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 83c905d928..87eb5d5256 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -61,6 +61,7 @@
#include <camel/camel-folder.h>
#include <camel/camel-vee-folder.h>
#include <camel/camel-vee-store.h>
+#include <camel/camel-operation.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
@@ -486,6 +487,7 @@ emfb_init(GObject *o)
efb = (EFilterBar *)emfb->search;
efb->account_search_vf = NULL;
efb->all_account_search_vf = NULL;
+ efb->account_search_cancel = NULL;
e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items);
e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items);
e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE);
@@ -921,6 +923,7 @@ struct _setup_msg {
MailMsg base;
CamelFolder *folder;
+ CamelOperation *cancel;
char *query;
GList *sources_uri;
GList *sources_folder;
@@ -938,6 +941,9 @@ vfolder_setup_exec(struct _setup_msg *m)
GList *l, *list = NULL;
CamelFolder *folder;
+ if (m->cancel)
+ camel_operation_register (m->cancel);
+
d(printf("Setting up Search Folder: %s\n", m->folder->full_name));
camel_vee_folder_set_expression((CamelVeeFolder *)m->folder, m->query);
@@ -1011,7 +1017,7 @@ static MailMsgInfo vfolder_setup_info = {
/* sources_uri should be camel uri's */
static int
-vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList *sources_folder)
+vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList *sources_folder, CamelOperation *cancel)
{
struct _setup_msg *m;
int id;
@@ -1023,6 +1029,10 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList
m->sources_uri = sources_uri;
m->sources_folder = sources_folder;
+ if (cancel) {
+ m->cancel = cancel;
+ }
+
id = m->base.seq;
mail_msg_slow_ordered_push (m);
@@ -1070,10 +1080,14 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
case E_FILTERBAR_CURRENT_ACCOUNT_ID:
word = e_search_bar_get_text (esb);
if (!(word && *word)) {
- mail_cancel_all ();
if (efb->account_search_vf) {
camel_object_unref (efb->account_search_vf);
efb->account_search_vf = NULL;
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
}
g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0);
gtk_widget_set_sensitive (esb->scopeoption, TRUE);
@@ -1109,8 +1123,8 @@ 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 */
-
- vfolder_setup ((CamelFolder *)efb->account_search_vf, search_word, NULL, folder_list_account);
+ 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);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->account_search_vf);
emfb_set_search_folder (emfv, (CamelFolder *)efb->account_search_vf, folder_uri);
@@ -1126,10 +1140,14 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
case E_FILTERBAR_ALL_ACCOUNTS_ID:
word = e_search_bar_get_text (esb);
if (!(word && *word)) {
- mail_cancel_all ();
if (efb->all_account_search_vf) {
camel_object_unref (efb->all_account_search_vf);
efb->all_account_search_vf=NULL;
+ if (efb->account_search_cancel) {
+ camel_operation_cancel (efb->account_search_cancel);
+ camel_operation_unref (efb->account_search_cancel);
+ efb->account_search_cancel = NULL;
+ }
}
g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0);
gtk_widget_set_sensitive (esb->scopeoption, TRUE);
@@ -1187,9 +1205,11 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb)
l = l->next;
}
- vfolder_setup ((CamelFolder *)efb->all_account_search_vf, search_word, NULL, folder_list);
+ 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);
folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->all_account_search_vf);
+
emfb_set_search_folder (emfv, (CamelFolder *)efb->all_account_search_vf, folder_uri);
g_free (folder_uri);
g_free (storeuri);
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 6deb136862..3e530c7cd2 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-25 Johnny Jacob <jjohnny@novell.com>
+
+ * e-filter-bar.h : Added a cameloperation cancel field for vfolder
+ based search.
+
2008-01-24 Tor Lillqvist <tml@novell.com>
* Makefile.am (libemiscwidgets_la_LIBADD): Fix typo:
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index e80f7747ef..be77dbdb39 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -1,4 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
/*
* e-search-bar.c
*
@@ -992,6 +993,7 @@ e_filter_bar_new_construct (RuleContext *context,
bar->all_account_search_vf = NULL;
bar->account_search_vf = NULL;
+ bar->account_search_cancel = NULL;
e_search_bar_construct ((ESearchBar *)bar, &item, &item);
diff --git a/widgets/misc/e-filter-bar.h b/widgets/misc/e-filter-bar.h
index 7588517c4b..abcc03f817 100644
--- a/widgets/misc/e-filter-bar.h
+++ b/widgets/misc/e-filter-bar.h
@@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include <camel/camel-vee-folder.h>
+#include <camel/camel-operation.h>
#include "e-search-bar.h"
@@ -75,7 +76,7 @@ struct _EFilterBar {
CamelVeeFolder *all_account_search_vf;
CamelVeeFolder *account_search_vf;
-
+ CamelOperation *account_search_cancel;
};
struct _EFilterBarClass