diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-06-18 05:44:06 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-06-18 05:44:06 +0800 |
commit | 08344be402eec12ad834f39ea68ed54f672193db (patch) | |
tree | fdb7a5bdd96e07b68e76efbed4842aec53ecba55 /camel | |
parent | 09129f6072fa280f989afd1bc1320215c8b30302 (diff) | |
download | gsoc2013-evolution-08344be402eec12ad834f39ea68ed54f672193db.tar.gz gsoc2013-evolution-08344be402eec12ad834f39ea68ed54f672193db.tar.zst gsoc2013-evolution-08344be402eec12ad834f39ea68ed54f672193db.zip |
Update the freeze state of the new source folder.
2002-06-17 Jeffrey Stedfast <fejj@ximian.com>
* camel-vee-folder.c (camel_vee_folder_add_folder): Update the
freeze state of the new source folder.
(camel_vee_folder_remove_folder): Undo any freeze state that we
have imposed on this source folder.
svn path=/trunk/; revision=17216
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/camel-private.h | 1 | ||||
-rw-r--r-- | camel/camel-vee-folder.c | 33 |
3 files changed, 37 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 6122390f5a..23d8169114 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2002-06-17 Jeffrey Stedfast <fejj@ximian.com> + + * camel-vee-folder.c (camel_vee_folder_add_folder): Update the + freeze state of the new source folder. + (camel_vee_folder_remove_folder): Undo any freeze state that we + have imposed on this source folder. + 2002-06-14 Jeffrey Stedfast <fejj@ximian.com> * camel-vee-folder.c (vee_freeze): Freeze source folders. diff --git a/camel/camel-private.h b/camel/camel-private.h index 3d1e7e445c..5c978da9ac 100644 --- a/camel/camel-private.h +++ b/camel/camel-private.h @@ -182,6 +182,7 @@ struct _CamelStoreSummaryPrivate { struct _CamelVeeFolderPrivate { GList *folders; /* lock using subfolder_lock before changing/accessing */ GList *folders_changed; /* for list of folders that have changed between updates */ + int freeze_count; #ifdef ENABLE_THREADS GMutex *summary_lock; /* for locking vfolder summary */ diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index eb9a5d21b9..7acad9729e 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -341,7 +341,8 @@ void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub) { struct _CamelVeeFolderPrivate *p = _PRIVATE(vf), *up = _PRIVATE(folder_unmatched); - + int i; + if (vf == (CamelVeeFolder *)sub) { g_warning("Adding a virtual folder to itself as source, ignored"); return; @@ -353,10 +354,17 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub) if (g_list_find(p->folders, sub) == NULL) { camel_object_ref((CamelObject *)sub); p->folders = g_list_append(p->folders, sub); + + /* update the freeze state of 'sub' to match our freeze state */ + for (i = 0; i < p->freeze_count; i++) + camel_folder_freeze (sub); } if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER(sub)) { camel_object_ref((CamelObject *)sub); up->folders = g_list_append(up->folders, sub); + /* update the freeze state of 'sub' to match Unmatched's freeze state */ + for (i = 0; i < up->freeze_count; i++) + camel_folder_freeze (sub); } CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock); @@ -382,7 +390,8 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub) { struct _CamelVeeFolderPrivate *p = _PRIVATE(vf), *up = _PRIVATE(folder_unmatched); int killun = FALSE; - + int i; + CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock); CAMEL_VEE_FOLDER_LOCK(vf, changed_lock); @@ -393,13 +402,17 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub) CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock); return; } - + 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); p->folders = g_list_remove(p->folders, sub); - + + /* undo the freeze state that we have imposed on this source folder */ + for (i = 0; i < p->freeze_count; i++) + camel_folder_thaw (sub); + CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock); CAMEL_VEE_FOLDER_LOCK(folder_unmatched, subfolder_lock); @@ -409,11 +422,19 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub) killun = TRUE; up->folders = g_list_remove(up->folders, sub); camel_object_unref((CamelObject *)sub); + + /* undo the freeze state that Unmatched has imposed on this source folder */ + for (i = 0; i < p->freeze_count; i++) + camel_folder_thaw (sub); } } else if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) { if (g_list_find(up->folders, sub) != NULL) { up->folders = g_list_remove(up->folders, sub); camel_object_unref((CamelObject *)sub); + + /* undo the freeze state that Unmatched has imposed on this source folder */ + for (i = 0; i < p->freeze_count; i++) + camel_folder_thaw (sub); } if (g_list_find(up->folders, sub) == NULL) { killun = TRUE; @@ -1583,6 +1604,8 @@ vee_freeze (CamelFolder *folder) CAMEL_VEE_FOLDER_LOCK (vfolder, subfolder_lock); + p->freeze_count++; + node = p->folders; while (node) { CamelFolder *f = node->data; @@ -1606,6 +1629,8 @@ vee_thaw (CamelFolder *folder) CAMEL_VEE_FOLDER_LOCK (vfolder, subfolder_lock); + p->freeze_count--; + node = p->folders; while (node) { CamelFolder *f = node->data; |