[gnome-music/wip/jfelder/songwidget-listboxrow: 3/8] searchview: Ensure that the song rows are not selectable




commit 587abe8523fcea79bc790e0d2bb50fbad9fe1a17
Author: Jean Felder <jfelder src gnome org>
Date:   Sat May 8 17:29:17 2021 +0200

    searchview: Ensure that the song rows are not selectable
    
    This ensures that the play indicator stays visible when a row is
    activated. The rows cannot be selected at the moment but the next
    commit will introduce it.

 gnomemusic/views/searchview.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 5d54a3666..d251caf54 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -39,6 +39,7 @@ from gnomemusic.widgets.artistsearchtile import ArtistSearchTile
 from gnomemusic.widgets.songwidget import SongWidget
 if typing.TYPE_CHECKING:
     from gnomemusic.application import Application
+    from gnomemusic.coresong import CoreSong
 
 
 @Gtk.Template(resource_path="/org/gnome/Music/ui/SearchView.ui")
@@ -153,7 +154,7 @@ class SearchView(Gtk.Stack):
 
         return False
 
-    def _create_song_widget(self, coresong):
+    def _create_song_widget(self, coresong: CoreSong) -> Gtk.ListBoxRow:
         song_widget = SongWidget(coresong, False, True)
         song_widget.props.show_song_number = False
 
@@ -162,9 +163,11 @@ class SearchView(Gtk.Stack):
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
 
-        song_widget.connect('button-release-event', self._song_activated)
+        row = Gtk.ListBoxRow()
+        row.props.selectable = False
+        row.add(song_widget)
 
-        return song_widget
+        return row
 
     def _create_album_widget(self, corealbum):
         album_widget = AlbumCover(corealbum)


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