[geary/mjog/1193-conversation-buttons-resize-race: 7/13] client: Ensure conversation list action bar shown when main window folded




commit 87b8707fd6f764b1dc81fb2b1ab53af4d752f8e3
Author: Michael Gratton <mike vee net>
Date:   Sun Apr 11 12:00:35 2021 +1000

    client: Ensure conversation list action bar shown when main window folded

 .../application/application-main-window.vala       | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/application-main-window.vala 
b/src/client/application/application-main-window.vala
index 7b8bf265b..ef5eeea8d 100644
--- a/src/client/application/application-main-window.vala
+++ b/src/client/application/application-main-window.vala
@@ -262,7 +262,19 @@ public class Application.MainWindow :
     }
 
 
-    private enum ConversationCount { NONE, SINGLE, MULTIPLE; }
+    private enum ConversationCount {
+        NONE, SINGLE, MULTIPLE;
+
+        public static ConversationCount for_size(int size) {
+            return (
+                size == 0
+                ? NONE
+                : size == 1
+                ? SINGLE
+                : MULTIPLE
+            );
+        }
+    }
 
 
     /** Returns the window's associated client application instance. */
@@ -1808,12 +1820,18 @@ public class Application.MainWindow :
         );
 
         this.update_context_dependent_actions.begin(sensitive);
+        update_conversation_list_actions_revealer(count);
+    }
+
+    private void update_conversation_list_actions_revealer(ConversationCount count) {
         switch (count) {
         case NONE:
             this.conversation_list_actions_revealer.reveal_child = false;
             break;
         case SINGLE:
-            this.conversation_list_actions_revealer.reveal_child = false;
+            this.conversation_list_actions_revealer.reveal_child = (
+                this.outer_leaflet.folded
+            );
             break;
         case MULTIPLE:
             this.conversation_list_actions_revealer.reveal_child = true;
@@ -2060,6 +2078,10 @@ public class Application.MainWindow :
 
     [GtkCallback]
     private void on_outer_leaflet_changed() {
+        int selected = this.conversation_list_view.get_selected().size;
+        update_conversation_list_actions_revealer(
+            ConversationCount.for_size(selected)
+        );
         if (this.has_composer &&
             (this.is_folder_list_shown || this.is_conversation_list_shown)) {
             close_composer(false, false);


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