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




commit 356613a9bf229dfe82a6a49809c77b9b737f4825
Author: Jean Felder <jfelder src gnome org>
Date:   Sat May 8 17:41:17 2021 +0200

    playlistswidget: 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/widgets/playlistswidget.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/widgets/playlistswidget.py b/gnomemusic/widgets/playlistswidget.py
index 7f76122b6..74c8a99cf 100644
--- a/gnomemusic/widgets/playlistswidget.py
+++ b/gnomemusic/widgets/playlistswidget.py
@@ -34,6 +34,8 @@ from gnomemusic.widgets.playlistdialog import PlaylistDialog
 from gnomemusic.widgets.songwidget import SongWidget
 if typing.TYPE_CHECKING:
     from gnomemusic.application import Application
+    from gnomemusic.coresong import CoreSong
+    from gnomemusic.grilowrappers.grltrackerplaylists import Playlist
     from gnomemusic.view.playlistsview import PlaylistsView
 
 
@@ -99,7 +101,8 @@ class PlaylistsWidget(Gtk.Box):
 
         self._remove_song_action.set_enabled(not playlist.props.is_smart)
 
-    def _create_song_widget(self, coresong, playlist):
+    def _create_song_widget(
+            self, coresong: CoreSong, playlist: Playlist) -> Gtk.ListBoxRow:
         can_dnd = not playlist.props.is_smart
         song_widget = SongWidget(coresong, can_dnd, True)
         song_widget.props.show_song_number = False
@@ -108,7 +111,11 @@ class PlaylistsWidget(Gtk.Box):
         if can_dnd is True:
             song_widget.connect("widget_moved", self._on_song_widget_moved)
 
-        return song_widget
+        row = Gtk.ListBoxRow()
+        row.props.selectable = False
+        row.add(song_widget)
+
+        return row
 
     def _on_song_activated(self, widget, event):
         coresong = widget.props.coresong


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