evolution r34905 - trunk/mail



Author: sragavan
Date: Mon Jan 28 03:41:49 2008
New Revision: 34905
URL: http://svn.gnome.org/viewvc/evolution?rev=34905&view=rev

Log:
2008-01-24  Srinivasa Ragavan  <sragavan novell com>

	** Fix for bug #511488

	* em-folder-tree-model.c: (em_folder_tree_model_signal_block):
	* em-folder-tree-model.h: Function to block folder-created function.
	* mail-vfolder.c: (vfolder_load_storage): Block the signal handler
	when loading.





Modified:
   trunk/mail/ChangeLog
   trunk/mail/em-folder-tree-model.c
   trunk/mail/em-folder-tree-model.h
   trunk/mail/mail-vfolder.c

Modified: trunk/mail/em-folder-tree-model.c
==============================================================================
--- trunk/mail/em-folder-tree-model.c	(original)
+++ trunk/mail/em-folder-tree-model.c	Mon Jan 28 03:41:49 2008
@@ -851,6 +851,23 @@
 	gtk_tree_path_free (path);
 }
 
+void
+em_folder_tree_model_signal_block (EMFolderTreeModel *model, CamelStore *store, gboolean block)
+{
+	struct _EMFolderTreeModelStoreInfo *si;
+
+	si = g_hash_table_lookup (model->store_hash, store);
+	if (!si)
+		return;
+
+	if (block) {
+		if (si->created_id) 
+			camel_object_unhook_event (store, "folder_created", CAMEL_CALLBACK (folder_created_cb), model);
+		si->created_id = 0;
+	} else {
+		si->created_id = camel_object_hook_event (store, "folder_created", CAMEL_CALLBACK (folder_created_cb), model);
+	}
+}
 
 static void
 em_folder_tree_model_remove_uri (EMFolderTreeModel *model, const char *uri)

Modified: trunk/mail/em-folder-tree-model.h
==============================================================================
--- trunk/mail/em-folder-tree-model.h	(original)
+++ trunk/mail/em-folder-tree-model.h	Mon Jan 28 03:41:49 2008
@@ -148,6 +148,7 @@
 void em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *store, const char *path, int unread);
 gboolean em_folder_tree_model_is_type_inbox (EMFolderTreeModel *model, CamelStore *store, const char *full);
 char * em_folder_tree_model_get_folder_name (EMFolderTreeModel *model, CamelStore *store, const char *full);
+void em_folder_tree_model_signal_block (EMFolderTreeModel *model, CamelStore *store, gboolean block);
 
 #ifdef __cplusplus
 }

Modified: trunk/mail/mail-vfolder.c
==============================================================================
--- trunk/mail/mail-vfolder.c	(original)
+++ trunk/mail/mail-vfolder.c	Mon Jan 28 03:41:49 2008
@@ -36,6 +36,7 @@
 #include "e-util/e-error.h"
 #include "e-util/e-util-private.h"
 
+#include "em-folder-tree-model.h"
 #include "em-utils.h"
 #include "em-vfolder-context.h"
 #include "em-vfolder-editor.h"
@@ -63,7 +64,6 @@
 /* This is a slightly hacky solution to shutting down, we poll this variable in various
    loops, and just quit processing if it is set. */
 static volatile int shutdown;		/* are we shutting down? */
-
 /* more globals ... */
 extern CamelSession *session;
 
@@ -902,6 +902,7 @@
 	char *user, *storeuri;
 	FilterRule *rule;
 	char *xmlfile;
+	struct _EMFolderTreeModel *model = mail_component_peek_tree_model (mail_component_peek ());
 
 	pthread_mutex_lock (&lock);
 
@@ -950,12 +951,21 @@
 
 	/* and setup the rules we have */
 	rule = NULL;
+
+	d(printf("rule added: %s\n", rule->name));
+
+	/* Note: We block the signal handlers to be exact folder_created, since 
+	 * there is a race betweeen folder_created emitted through camel_store_get_folder and 
+	 * the store info that is fetched and added for vfolder. Due to this, two vfolders 
+	 * appear on the search folder. See bug BGO #511488 */
+	em_folder_tree_model_signal_block (model, vfolder_store, TRUE);
 	while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) {
 		if (rule->name)
 			context_rule_added((RuleContext *)context, rule);
 		else
 			d(printf("invalid rule (%p) encountered: rule->name is NULL\n", rule));
 	}
+	em_folder_tree_model_signal_block (model, vfolder_store, FALSE);	
 
 	g_free(storeuri);
 }



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