aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
author2 <NotZed@Ximian.com>2001-10-13 06:27:56 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-13 06:27:56 +0800
commit47d5ddd05759815a8a11d4083298e1b81bf02163 (patch)
treee1b577eae85fe885da12d3c724a6f5b271e602bc /camel
parentd3f00283207c153d707c957ad657a97eb6494247 (diff)
downloadgsoc2013-evolution-47d5ddd05759815a8a11d4083298e1b81bf02163.tar.gz
gsoc2013-evolution-47d5ddd05759815a8a11d4083298e1b81bf02163.tar.zst
gsoc2013-evolution-47d5ddd05759815a8a11d4083298e1b81bf02163.zip
Unhook from all events before removing folder.
2001-10-12 <NotZed@Ximian.com> * camel-vee-folder.c (camel_vee_folder_remove_folder): Unhook from all events before removing folder. (camel_vee_folder_add_folder): Hook onto delete event. (camel_vee_folder_finalise): Unhook from deleted event for suibfolder. (subfolder_deleted): When the folder is deleted, remove it from the vfolder automagically. svn path=/trunk/; revision=13639
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/camel-vee-folder.c15
2 files changed, 23 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d4bb72ea95..22326dda8f 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-12 <NotZed@Ximian.com>
+
+ * camel-vee-folder.c (camel_vee_folder_remove_folder): Unhook from
+ all events before removing folder.
+ (camel_vee_folder_add_folder): Hook onto delete event.
+ (camel_vee_folder_finalise): Unhook from deleted event for suibfolder.
+ (subfolder_deleted): When the folder is deleted, remove it from
+ the vfolder automagically.
+
2001-10-11 <NotZed@Ximian.com>
* camel-vee-folder.c (vee_search_by_uids): convert the uids list
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 81a38ae7b5..26f724ab56 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -72,7 +72,7 @@ static void vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *source);
static void message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf);
static void folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder *vf);
-
+static void subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf);
static void folder_changed_remove_uid(CamelFolder *sub, const char *uid, const char hash[8], int keep, CamelVeeFolder *vf);
@@ -176,6 +176,7 @@ camel_vee_folder_finalise (CamelObject *obj)
if (vf != folder_unmatched) {
camel_object_unhook_event((CamelObject *)f, "folder_changed", (CamelObjectEventHookFunc) folder_changed, vf);
camel_object_unhook_event((CamelObject *)f, "message_changed", (CamelObjectEventHookFunc) message_changed, vf);
+ camel_object_unhook_event((CamelObject *)f, "deleted", (CamelObjectEventHookFunc) subfolder_deleted, vf);
/* this updates the vfolder */
if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0)
vee_folder_remove_folder(vf, f);
@@ -354,6 +355,7 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
camel_object_hook_event((CamelObject *)sub, "folder_changed", (CamelObjectEventHookFunc)folder_changed, vf);
camel_object_hook_event((CamelObject *)sub, "message_changed", (CamelObjectEventHookFunc)message_changed, vf);
+ camel_object_hook_event((CamelObject *)sub, "deleted", (CamelObjectEventHookFunc)subfolder_deleted, vf);
vee_folder_build_folder(vf, sub, NULL);
}
@@ -391,6 +393,10 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
vee_folder_remove_folder(vf, sub);
+ camel_object_unhook_event((CamelObject *)sub, "folder_changed", (CamelObjectEventHookFunc) folder_changed, vf);
+ camel_object_unhook_event((CamelObject *)sub, "message_changed", (CamelObjectEventHookFunc) message_changed, vf);
+ camel_object_unhook_event((CamelObject *)sub, "deleted", (CamelObjectEventHookFunc) subfolder_deleted, vf);
+
camel_object_unref((CamelObject *)sub);
}
@@ -1333,3 +1339,10 @@ message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf)
folder_changed(f, changes, vf);
camel_folder_change_info_free(changes);
}
+
+/* track vanishing folders */
+static void
+subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf)
+{
+ camel_vee_folder_remove_folder(vf, f);
+}