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




commit 89fbc374f7a870fe932a56e968ec3c564bba9ee1
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          | 12 ++++++++++++
 gnomemusic/views/searchview.py |  8 ++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/SearchView.ui b/data/ui/SearchView.ui
index ff19fddd9..2e82b8eea 100644
--- a/data/ui/SearchView.ui
+++ b/data/ui/SearchView.ui
@@ -231,6 +231,18 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkScrolledWindow" id="_scrolled_album_widget">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="hscrollbar_policy">never</property>
+        <style>
+          <class name="view"/>
+        </style>
+      </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]