[gnome-music/wip/mschraal/searchview-albumwidget-scrolling: 6/6] searchview: Add a ScrolledWindow for AlbumWidget




commit 77645e10497080293e7ae1f20d7890ebb6dc7280
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Aug 17 23:47:31 2021 +0200

    searchview: Add a ScrolledWindow for AlbumWidget
    
    In 57138fad AlbumWidget dropped it's ScrolledWindow, but SearchView was
    not yet adapted to this change.
    
    Make it so.

 data/ui/SearchView.ui          | 6 ++++++
 gnomemusic/views/searchview.py | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/SearchView.ui b/data/ui/SearchView.ui
index 818a7fd77..a6e41ee37 100644
--- a/data/ui/SearchView.ui
+++ b/data/ui/SearchView.ui
@@ -235,6 +235,12 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkScrolledWindow" id="_scrolled_album_widget">
+        <property name="visible">True</property>
+        <property name="hscrollbar_policy">never</property>
+      </object>
+    </child>
   </template>
   <object class="GtkGestureMultiPress" id="_songs_listbox_ctrlr">
     <property name="widget">_songs_listbox</property>
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 0c14bc454..bea60950d 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -74,6 +74,7 @@ class SearchView(Gtk.Stack):
     _artist_header = Gtk.Template.Child()
     _artist_all_flowbox = Gtk.Template.Child()
     _artist_flowbox = Gtk.Template.Child()
+    _scrolled_album_widget = Gtk.Template.Child()
     _search_results = Gtk.Template.Child()
     _songs_header = Gtk.Template.Child()
     _songs_listbox = Gtk.Template.Child()
@@ -139,8 +140,7 @@ class SearchView(Gtk.Stack):
         self._album_widget.bind_property(
             "selection-mode", self, "selection-mode",
             GObject.BindingFlags.BIDIRECTIONAL)
-
-        self.add(self._album_widget)
+        self._scrolled_album_widget.add(self._album_widget)
 
         self._scrolled_artist_window: Optional[Gtk.ScrolledWindow] = None
 
@@ -381,7 +381,7 @@ class SearchView(Gtk.Stack):
         self._headerbar.props.title = corealbum.props.title
         self._headerbar.props.subtitle = corealbum.props.artist
 
-        self.set_visible_child(self._album_widget)
+        self.set_visible_child(self._scrolled_album_widget)
         self.props.search_mode_active = False
 
     @Gtk.Template.Callback()
@@ -462,7 +462,7 @@ class SearchView(Gtk.Stack):
             with self._model.freeze_notify():
                 self._artist_all_flowbox.foreach(child_select)
         elif self.props.state == SearchView.State.ALBUM:
-            view = self.get_visible_child()
+            view = self._album_widget
             if value is True:
                 view.select_all()
             else:


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