[geary/wip/delete-folder-714357: 3/4] Sort paths before removing



commit c83bd1315e40e9162c15400dff17fd9639747a7e
Author: Charles Lindsay <chaz yorba org>
Date:   Wed Feb 12 17:42:39 2014 -0800

    Sort paths before removing

 .../imap-engine/imap-engine-generic-account.vala   |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 30d8465..cd3b24c 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -636,8 +636,10 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.AbstractAccount {
         notify_folders_available_unavailable(null, to_remove);
         
         Gee.ArrayList<Geary.Folder> engine_removed = new Gee.ArrayList<Geary.Folder>();
+        
+        // Sort by path length descending, so we always remove children first.
+        to_remove.sort((a, b) => b.path.get_path_length() - a.path.get_path_length());
         foreach (Geary.Folder folder in to_remove) {
-            // TODO: sort folder paths by length, longest first
             try {
                 debug("Locally deleting removed folder %s", folder.to_string());
                 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]