[gnome-music/wip/jfelder/3-34-stop-deleted-playlist] playlistcontrols: Stop a deleted playlist if it is playing



commit c414b96b27329816c412b512474b819e171043fb
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Feb 27 12:30:29 2020 +0100

    playlistcontrols: Stop a deleted playlist if it is playing
    
    On a playlist deletion, stop the the player and hide the player
    toolbar if the player playlist is the playlist which is deleted.
    
    This feature was lost during the core rewrite.

 gnomemusic/views/playlistsview.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 8a38d565..6c6be6f5 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -340,17 +340,16 @@ class PlaylistsView(BaseView):
         selected_row = self._sidebar.get_selected_row()
         selected_playlist = selected_row.props.playlist
 
+        active_playlist = self._coremodel.props.active_playlist
+        if (active_playlist is not None
+                and active_playlist == selected_playlist):
+            self._player.stop()
+            self._window.set_player_visible(False)
+
         notification = PlaylistNotification(  # noqa: F841
             self._window.notifications_popup, self._coremodel,
             PlaylistNotification.Type.PLAYLIST, selected_playlist)
 
-        # FIXME: Should Check that the playlist is not playing
-        # playlist_id = selection.playlist.props.pl_id
-        # if self._player.playing_playlist(
-        #         PlayerPlaylist.Type.PLAYLIST, playlist_id):
-        #     self._player.stop()
-        #     self._window.set_player_visible(False)
-
     def _on_song_widget_moved(self, target, source_position):
         target_position = target.get_parent().get_index()
         selection = self._sidebar.get_selected_row()


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