[geary/mjog/info-bar-cleanup: 3/3] Components.InfoBarStack: Don't remove current info bar if expanding



commit 0a4cf8fb18890f04c153c685ce06a755f450460c
Author: Michael Gratton <mike vee net>
Date:   Fri Apr 3 09:30:29 2020 +1100

    Components.InfoBarStack: Don't remove current info bar if expanding
    
    Check that the allocation is decreasing before removing the info bar
    so that it is not removed when it is being revealed in the first place.

 src/client/components/components-info-bar-stack.vala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/client/components/components-info-bar-stack.vala 
b/src/client/components/components-info-bar-stack.vala
index 2c5d896b..8bebed98 100644
--- a/src/client/components/components-info-bar-stack.vala
+++ b/src/client/components/components-info-bar-stack.vala
@@ -99,6 +99,7 @@ public class Components.InfoBarStack : Gtk.Frame, Geary.BaseInterface {
     }
 
     private Gee.Queue<Gtk.InfoBar> available = new SingletonQueue();
+    private int last_allocated_height = 0;
 
 
     construct {
@@ -162,6 +163,7 @@ public class Components.InfoBarStack : Gtk.Frame, Geary.BaseInterface {
             // Not currently showing anything and there's nothing to
             // show, so hide the frame
             this.visible = false;
+            this.last_allocated_height = 0;
         }
     }
 
@@ -170,8 +172,11 @@ public class Components.InfoBarStack : Gtk.Frame, Geary.BaseInterface {
         if (current != null) {
             Gtk.Allocation alloc;
             get_allocation(out alloc);
-            if (alloc.height < 2) {
+            bool shrinking = this.last_allocated_height > alloc.height;
+            this.last_allocated_height = alloc.height;
+            if (shrinking && alloc.height < 2) {
                 this.size_allocate.disconnect(on_allocation_changed);
+                this.available.remove(current);
                 base.remove(current);
                 update();
             }


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