Re: [evolution-patches] 63881 (dragging messages from vfolders)
- From: Edward Catmur <ed catmur co uk>
- To: Not Zed <notzed ximian com>
- Cc: asdf <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] 63881 (dragging messages from vfolders)
- Date: Fri, 27 Aug 2004 20:19:34 +0100
Argh, forgot to put a guard in the later vfolder_load_storage. Fixed
here.
Ed
--- camel/camel-vee-folder.h 2004/08/27 02:42:30 1.1
+++ camel/camel-vee-folder.h 2004/08/27 02:42:35
@@ -77,6 +77,8 @@ void camel_vee_folder_set_expressio
void camel_vee_folder_hash_folder (CamelFolder *folder, char buffer[8]);
+void camel_vee_folder_unmatched_setup (CamelStore *parent_store);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
--- camel/camel-vee-folder.c 2004/08/27 02:36:37 1.1
+++ camel/camel-vee-folder.c 2004/08/27 03:11:39
@@ -228,21 +228,37 @@ vee_folder_construct (CamelVeeFolder *vf
folder->summary->message_info_size = sizeof(CamelVeeMessageInfo);
}
+/**
+ * camel_vee_folder_unmatched_setup:
+ * @parent_store: the 1 static vfolder store from mail-vfolder.c
+ *
+ * Setup unmatched folder. Should happen before anything else; however if
+ * the vfolder store does not exist this will need to be initialised from the
+ * vtrash stores so that things don't fall apart.
+ *
+ * Return value: none.
+ **/
void
-camel_vee_folder_construct(CamelVeeFolder *vf, CamelStore *parent_store, const char *name, guint32 flags)
+camel_vee_folder_unmatched_setup(CamelStore *parent_store)
{
UNMATCHED_LOCK();
- /* setup unmatched folder if we haven't yet */
if (folder_unmatched == NULL) {
unmatched_uids = g_hash_table_new (g_str_hash, g_str_equal);
folder_unmatched = (CamelVeeFolder *)camel_object_new (camel_vee_folder_get_type ());
- d(printf("created foldeer unmatched %p\n", folder_unmatched));
+ d(printf("created folder_unmatched %p\n", folder_unmatched));
vee_folder_construct (folder_unmatched, parent_store, CAMEL_UNMATCHED_NAME, CAMEL_STORE_FOLDER_PRIVATE);
}
UNMATCHED_UNLOCK();
+}
+
+void
+camel_vee_folder_construct(CamelVeeFolder *vf, CamelStore *parent_store, const char *name, guint32 flags)
+{
+ if (folder_unmatched == NULL)
+ camel_vee_folder_unmatched_setup (parent_store);
vee_folder_construct (vf, parent_store, name, flags);
}
@@ -262,18 +278,9 @@ camel_vee_folder_new(CamelStore *parent_
{
CamelVeeFolder *vf;
char *tmp;
-
- UNMATCHED_LOCK();
-
- /* setup unmatched folder if we haven't yet */
- if (folder_unmatched == NULL) {
- unmatched_uids = g_hash_table_new(g_str_hash, g_str_equal);
- folder_unmatched = vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type());
- d(printf("created foldeer unmatched %p\n", folder_unmatched));
- vee_folder_construct (vf, parent_store, CAMEL_UNMATCHED_NAME, CAMEL_STORE_FOLDER_PRIVATE);
- }
-
- UNMATCHED_UNLOCK();
+
+ if (folder_unmatched == NULL)
+ camel_vee_folder_unmatched_setup (parent_store);
if (strcmp(name, CAMEL_UNMATCHED_NAME) == 0) {
vf = folder_unmatched;
--- mail/mail-vfolder.h 2004/08/27 02:43:15 1.1
+++ mail/mail-vfolder.h 2004/08/27 02:43:29
@@ -9,6 +9,7 @@
#include "em-vfolder-rule.h"
#include "filter/filter-part.h"
+void vfolder_create_storage(void);
void vfolder_load_storage(void);
void vfolder_revert(void);
--- mail/mail-vfolder.c 2004/08/27 02:43:45 1.1
+++ mail/mail-vfolder.c 2004/08/27 02:43:49
@@ -846,10 +846,9 @@ store_folder_renamed(CamelObject *o, voi
}
void
-vfolder_load_storage(void)
+vfolder_create_storage(void)
{
- char *user, *storeuri;
- FilterRule *rule;
+ char *storeuri;
vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -870,6 +869,19 @@ vfolder_load_storage(void)
d(printf("got store '%s' = %p\n", storeuri, vfolder_store));
mail_component_load_store_by_uri (mail_component_peek (), storeuri, _("VFolders"));
+
+ camel_vee_folder_unmatched_setup (vfolder_store);
+
+ g_free(storeuri);
+}
+
+void
+vfolder_load_storage(void)
+{
+ char *user;
+ FilterRule *rule;
+
+ g_return_if_fail (vfolder_store != NULL);
/* load our rules */
user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ()));
@@ -891,8 +901,6 @@ vfolder_load_storage(void)
else
d(printf("invalid rule (%p) encountered: rule->name is NULL\n", rule));
}
-
- g_free(storeuri);
}
void
--- mail/mail-component.c 2004/08/27 02:44:58 1.1
+++ mail/mail-component.c 2004/08/27 02:45:06
@@ -312,6 +312,7 @@ mc_startup(MailComponent *mc)
return;
started = 1;
+ vfolder_create_storage();
mc_setup_local_store(mc);
load_accounts(mc, mail_config_get_accounts());
vfolder_load_storage();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]