aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2008-01-28 11:41:49 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2008-01-28 11:41:49 +0800
commit0d3da13635b50c5ab26d121c7dfe939713cc2f91 (patch)
tree4cf8c9642d7788a74342fcfd63499aa160985450
parentc7235d29c634f57ae7caf832484fb7a6d9f5861f (diff)
downloadgsoc2013-evolution-0d3da13635b50c5ab26d121c7dfe939713cc2f91.tar.gz
gsoc2013-evolution-0d3da13635b50c5ab26d121c7dfe939713cc2f91.tar.zst
gsoc2013-evolution-0d3da13635b50c5ab26d121c7dfe939713cc2f91.zip
** Fix for bug #511488
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. svn path=/trunk/; revision=34905
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/em-folder-tree-model.c17
-rw-r--r--mail/em-folder-tree-model.h1
-rw-r--r--mail/mail-vfolder.c12
4 files changed, 38 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 003db2d774..4988b2d5d1 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -40,6 +40,15 @@
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.
+
+2008-01-24 Srinivasa Ragavan <sragavan@novell.com>
+
** Fix for bug #510779
** Fix for bug #504103
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index b394279d1b..7d174e8fbc 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -851,6 +851,23 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con
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)
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index b1801128fb..d4af60f883 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -148,6 +148,7 @@ void em_folder_tree_model_expand_foreach (EMFolderTreeModel *model, EMFTModelExp
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
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 75e0dc11f8..7ed1dfb93b 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -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 @@ static GHashTable *vfolder_hash;
/* 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 @@ vfolder_load_storage(void)
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 @@ vfolder_load_storage(void)
/* 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);
}