[gnome-music/wip/mschraal/asyncqueue-fixes: 4/6] albumsview: Fix visible stack page checks




commit 9c908aca6eab275eb1693275dcd7bc904529e1fb
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Sep 10 21:14:17 2021 +0200

    albumsview: Fix visible stack page checks
    
    Fallout of 57138fad4f. Some checks were based on the visible stack page,
    AlbumWidget is now packed in a scrolled window and this was not taken
    into account.
    
    Add names to stack pages and switch to using the names for the stack
    checks.

 data/ui/AlbumsView.ui          | 6 ++++++
 gnomemusic/views/albumsview.py | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/AlbumsView.ui b/data/ui/AlbumsView.ui
index a6c290819..a0832384c 100644
--- a/data/ui/AlbumsView.ui
+++ b/data/ui/AlbumsView.ui
@@ -29,6 +29,9 @@
           </object>
         </child>
       </object>
+      <packing>
+        <property name="name">grid</property>
+      </packing>
     </child>
     <child>
       <object class="GtkScrolledWindow" id="_album_scrolled_window">
@@ -38,6 +41,9 @@
         <property name="vexpand">True</property>
         <property name="hscrollbar_policy">never</property>
       </object>
+      <packing>
+        <property name="name">widget</property>
+      </packing>
     </child>
   </template>
   <object class="GtkGestureLongPress" id="_flowbox_long_press">
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 36978a8ef..1bc8d3984 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -164,7 +164,7 @@ class AlbumsView(Gtk.Stack):
     def _on_search_mode_changed(self, klass, param):
         if (not self.props.search_mode_active
                 and self._headerbar.props.stack.props.visible_child == self
-                and self.get_visible_child() == self._album_widget):
+                and self.get_visible_child_name() == "widget"):
             self._set_album_headerbar(self._album_widget.props.corealbum)
 
     def _create_widget(self, corealbum):
@@ -202,7 +202,7 @@ class AlbumsView(Gtk.Stack):
         self._album_widget.props.corealbum = corealbum
 
         self._set_album_headerbar(corealbum)
-        self.set_visible_child(self._album_scrolled_window)
+        self.set_visible_child_name("widget")
 
     def _set_album_headerbar(self, corealbum):
         self._headerbar.props.state = HeaderBar.State.CHILD
@@ -251,7 +251,7 @@ class AlbumsView(Gtk.Stack):
         """Selects or deselects all items.
         """
         with self._application.props.coreselection.freeze_notify():
-            if self.get_visible_child() == self._album_widget:
+            if self.get_visible_child_name() == "widget":
                 if selected is True:
                     self._album_widget.select_all()
                 else:


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