[geary/wip/cleanup-imap-folders-725695] Clean up Imap.Account's folder map
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/cleanup-imap-folders-725695] Clean up Imap.Account's folder map
- Date: Tue, 4 Mar 2014 23:25:07 +0000 (UTC)
commit 4b3a5cea8518778c803373cf62a3b00dfad8414c
Author: Charles Lindsay <chaz yorba org>
Date: Tue Mar 4 15:24:32 2014 -0800
Clean up Imap.Account's folder map
.../imap-engine/imap-engine-generic-account.vala | 3 +++
src/engine/imap/api/imap-account.vala | 9 +++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 29f7478..ad7d475 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -726,6 +726,9 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.AbstractAccount {
if (engine_added.size > 0 || engine_removed.size > 0)
notify_folders_added_removed(sort_by_path(engine_added), sort_by_path(engine_removed));
+ remote.folders_removed(Geary.traverse<Geary.Folder>(engine_removed)
+ .map<FolderPath>(f => f.path).to_array_list());
+
// report all altered folders
if (altered_paths.size > 0) {
Gee.ArrayList<Geary.Folder> altered = new Gee.ArrayList<Geary.Folder>();
diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala
index c04d314..0f4de58 100644
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@ -199,6 +199,15 @@ private class Geary.Imap.Account : BaseObject {
return folder;
}
+ internal void folders_removed(Gee.Collection<FolderPath> paths) {
+ foreach (FolderPath path in paths) {
+ if (path_to_mailbox.has_key(path))
+ path_to_mailbox.unset(path);
+ if (folders.has_key(path))
+ folders.unset(path);
+ }
+ }
+
public async int fetch_unseen_count_async(FolderPath path, Cancellable? cancellable)
throws Error {
check_open();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]