[geary] Only report Inbox deselected if Inbox is being removed: Bug #727744



commit b72b640d70a8464001dad9e8e8ef9f482b73b35f
Author: Jim Nelson <jim yorba org>
Date:   Wed Aug 13 15:22:50 2014 -0700

    Only report Inbox deselected if Inbox is being removed: Bug #727744
    
    Changing a specal folder type involves adding and removing the folder
    entry in the folder sidebar.  Prior logic would look in the Inboxes
    branch if the entry was not selected in the "normal" account branch
    but not verify the folder in Inboxes was the one being removed.  This
    triggered an unwarranted "nothing selected" signal that caused the
    conversation list to go blank at startup when Geary was associating
    special folder types with folders.
    
    Note that you must have multiple accounts registered w/ Geary to
    trigger this bug.

 src/client/folder-list/folder-list-tree.vala       |   12 ++++++++++--
 .../imap-engine/imap-engine-minimal-folder.vala    |    4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/client/folder-list/folder-list-tree.vala b/src/client/folder-list/folder-list-tree.vala
index 889417e..64950ca 100644
--- a/src/client/folder-list/folder-list-tree.vala
+++ b/src/client/folder-list/folder-list-tree.vala
@@ -109,11 +109,19 @@ public class FolderList.Tree : Sidebar.Tree {
         
         // If this is the current folder, unselect it.
         Sidebar.Entry? entry = account_branch.get_entry_for_path(folder.path);
-        if (has_branch(inboxes_branch) && (entry == null || !is_selected(entry)))
-            entry = inboxes_branch.get_entry_for_account(folder.account);
+        
+        // if not found or found but not selected, see if the folder is in the Inboxes branch
+        if (has_branch(inboxes_branch) && (entry == null || !is_selected(entry))) {
+            InboxFolderEntry? inbox_entry = inboxes_branch.get_entry_for_account(folder.account);
+            if (inbox_entry != null && inbox_entry.folder == folder)
+                entry = inbox_entry;
+        }
+        
+        // if found and selected, report nothing is selected in preparation for its removal
         if (entry != null && is_selected(entry))
             folder_selected(null);
         
+        // if Inbox, remove from inboxes branch, selected or not
         if (folder.special_folder_type == Geary.SpecialFolderType.INBOX)
             inboxes_branch.remove_inbox(folder.account);
         
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala 
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index f2e3a71..2808ab0 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -65,7 +65,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.AbstractFolder, Geary.Folde
         local_folder.email_complete.connect(on_email_complete);
     }
     
-    ~EngineFolder() {
+    ~MinimalFolder() {
         if (open_count > 0)
             warning("Folder %s destroyed without closing", to_string());
         
@@ -75,7 +75,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.AbstractFolder, Geary.Folde
     public void set_special_folder_type(SpecialFolderType new_type) {
         SpecialFolderType old_type = _special_folder_type;
         _special_folder_type = new_type;
-        if(old_type != new_type)
+        if (old_type != new_type)
             notify_special_folder_type_changed(old_type, new_type);
     }
     


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