[gnome-music/wip/jfelder/playlistview-random-song: 15/17] playlistview: Do not automatically select a song on play



commit 4afc14211d58089cfef67171c25293be9a77cb7a
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Apr 18 16:33:41 2019 +0200

    playlistview: Do not automatically select a song on play
    
    With the previous change, set_playlist method from the PlayerPlaylist
    will now automatically select a song according to the repeat mode if
    none is provided. Therefore, when clicking on the play button it is no
    longer necessary to provide a song to play.

 gnomemusic/views/playlistview.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 0db24771..e7878463 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -349,7 +349,9 @@ class PlaylistView(BaseView):
                 self._star_handler.star_renderer_click = False
                 return
 
-            _iter = self.model.get_iter(path)
+            _iter = None
+            if path:
+                _iter = self.model.get_iter(path)
             playlist_id = self._current_playlist.get_id()
             self.player.set_playlist(
                 PlayerPlaylist.Type.PLAYLIST, playlist_id, self.model, _iter)
@@ -601,14 +603,8 @@ class PlaylistView(BaseView):
 
     @log
     def _on_play_activate(self, menuitem, data=None):
-        _iter = self.model.get_iter_first()
-        if not _iter:
-            return
-
-        selection = self._view.get_selection()
-        selection.select_path(self.model.get_path(_iter))
         cols = self._view.get_columns()
-        self._view.emit('row-activated', self.model.get_path(_iter), cols[0])
+        self._view.emit('row-activated', None, cols[0])
 
     @log
     def _current_playlist_is_protected(self):


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