[geary/cherry-pick-d3badeda] Merge branch 'mjog/1004-missing-labels' into 'mainline'




commit a456c4b2cd1f2df7151766908cc0d7374142f6f8
Author: Michael Gratton <mike vee net>
Date:   Tue Sep 29 22:35:03 2020 +0000

    Merge branch 'mjog/1004-missing-labels' into 'mainline'
    
    client: Fix not all folders being displayed in additional main windows
    
    Closes #1004
    
    See merge request GNOME/geary!594
    
    (cherry picked from commit d3badedad7e3f89e446d31fe628f08cb07063b3f)
    
    bfbc7f5d client: Fix not all folders being displayed in additional main windows

 src/client/application/application-folder-context.vala | 7 ++++++-
 src/client/application/application-main-window.vala    | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/application-folder-context.vala 
b/src/client/application/application-folder-context.vala
index b85c901b2..4ed47cf56 100644
--- a/src/client/application/application-folder-context.vala
+++ b/src/client/application/application-folder-context.vala
@@ -9,7 +9,8 @@
 /**
  * Collects application state related to a single folder.
  */
-public class Application.FolderContext : Geary.BaseObject {
+public class Application.FolderContext : Geary.BaseObject,
+    Gee.Comparable<FolderContext> {
 
 
     /** Specifies different kinds of displayable email counts. */
@@ -41,6 +42,10 @@ public class Application.FolderContext : Geary.BaseObject {
         update();
     }
 
+    public int compare_to(FolderContext other) {
+        return this.folder.path.compare_to(other.folder.path);
+    }
+
     private void update() {
         this.display_name = Util.I18n.to_folder_display_name(this.folder);
 
diff --git a/src/client/application/application-main-window.vala 
b/src/client/application/application-main-window.vala
index e8428459c..49833e542 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -1010,7 +1010,12 @@ public class Application.MainWindow :
             to_add.commands.undone.connect(on_command_undo);
             to_add.commands.redone.connect(on_command_redo);
 
-            add_folders(to_add.get_folders());
+            // Sort the folders so FolderListTree adds them all
+            // correctly
+            var added = new Gee.TreeSet<FolderContext>();
+            added.add_all(to_add.get_folders());
+
+            add_folders(added);
             this.accounts.add(to_add);
         }
     }


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