[gnome-contacts/wip/exalm/papercuts: 6/6] main-window: Unselect sidebar item in a less janky way




commit a65f1a87b6fd43986e3f76db6982dd7fdf91d3a6
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Aug 12 17:22:32 2022 +0400

    main-window: Unselect sidebar item in a less janky way
    
    Don't wait for the animation to end, just do it on visible-child changes
    instead. Do it when folding while on the contact list pane as well.

 data/ui/contacts-main-window.ui | 2 +-
 src/contacts-main-window.vala   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/contacts-main-window.ui b/data/ui/contacts-main-window.ui
index aa75626b..482c7ac5 100644
--- a/data/ui/contacts-main-window.ui
+++ b/data/ui/contacts-main-window.ui
@@ -63,7 +63,7 @@
           <object class="AdwLeaflet" id="content_box">
             <property name="can-navigate-back">True</property>
             <signal name="notify::folded" handler="on_folded"/>
-            <signal name="notify::child-transition-running" handler="on_child_transition_running"/>
+            <signal name="notify::visible-child" handler="on_visible_child"/>
 
             <child>
               <object class="AdwLeafletPage">
diff --git a/src/contacts-main-window.vala b/src/contacts-main-window.vala
index fdffed71..f6f465c9 100644
--- a/src/contacts-main-window.vala
+++ b/src/contacts-main-window.vala
@@ -369,12 +369,13 @@ public class Contacts.MainWindow : Adw.ApplicationWindow {
   [GtkCallback]
   private void on_folded () {
     update_header ();
+    on_visible_child ();
   }
 
   [GtkCallback]
-  private void on_child_transition_running () {
-    if (!this.content_box.child_transition_running &&
-         this.content_box.visible_child == this.list_pane_page)
+  private void on_visible_child () {
+    if (this.content_box.folded &&
+        this.content_box.visible_child == this.list_pane_page)
       this.store.selection.unselect_item (this.store.selection.get_selected ());
   }
 


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