evolution r34892 - in trunk: mail widgets/misc



Author: jjohnny
Date: Fri Jan 25 12:34:03 2008
New Revision: 34892
URL: http://svn.gnome.org/viewvc/evolution?rev=34892&view=rev

Log:
Fix for 467581 : wrap a/c searches in a camel-op for better cancellation.


Modified:
   trunk/mail/ChangeLog
   trunk/mail/em-folder-browser.c
   trunk/widgets/misc/ChangeLog
   trunk/widgets/misc/e-filter-bar.c
   trunk/widgets/misc/e-filter-bar.h

Modified: trunk/mail/em-folder-browser.c
==============================================================================
--- trunk/mail/em-folder-browser.c	(original)
+++ trunk/mail/em-folder-browser.c	Fri Jan 25 12:34:03 2008
@@ -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 @@
 		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 @@
 	MailMsg base;
 
 	CamelFolder *folder;
+	CamelOperation *cancel;
 	char *query;
 	GList *sources_uri;
 	GList *sources_folder;
@@ -938,6 +941,9 @@
 	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 @@
 
 /* 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 @@
 	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 @@
 	    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 @@
 			    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 @@
 	    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 @@
 				    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);

Modified: trunk/widgets/misc/e-filter-bar.c
==============================================================================
--- trunk/widgets/misc/e-filter-bar.c	(original)
+++ trunk/widgets/misc/e-filter-bar.c	Fri Jan 25 12:34:03 2008
@@ -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 @@
 
 	bar->all_account_search_vf = NULL;
 	bar->account_search_vf = NULL;
+ 	bar->account_search_cancel = NULL;
 
 	e_search_bar_construct ((ESearchBar *)bar, &item, &item);
 

Modified: trunk/widgets/misc/e-filter-bar.h
==============================================================================
--- trunk/widgets/misc/e-filter-bar.h	(original)
+++ trunk/widgets/misc/e-filter-bar.h	Fri Jan 25 12:34:03 2008
@@ -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 @@
 
 	CamelVeeFolder *all_account_search_vf;
 	CamelVeeFolder *account_search_vf;
-
+	CamelOperation *account_search_cancel;
 };
 
 struct _EFilterBarClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]