[gnome-music] view: Check if playlist is playing before checks on remove entry



commit 101f6827ee986a6544080f6e45103fee819c3fa3
Author: Arnel Borja <arnelborja src gnome org>
Date:   Thu May 8 23:00:40 2014 +0800

    view: Check if playlist is playing before checks on remove entry
    
    When deleting an entry in the playlist, check first if the playlist is
    indeed running before checking if the entry is currently playing.

 gnomemusic/view.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index b998544..60647a4 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -1095,10 +1095,10 @@ class Playlist(ViewContainer):
 
     @log
     def _on_song_removed_from_playlist(self, playlists, name, uri):
+        cached_playlist = self.player.running_playlist('Playlist', name)
         if name == self.current_playlist:
             model = self._model
         else:
-            cached_playlist = self.player.running_playlist('Playlist', name)
             if cached_playlist and cached_playlist != self._model:
                 model = cached_playlist
             else:
@@ -1108,7 +1108,7 @@ class Playlist(ViewContainer):
         for row in model:
             if row[5].get_url() == uri:
                 # Is the removed track now being played?
-                if name == self.current_playlist:
+                if name == self.current_playlist and cached_playlist == model:
                     if self.player.currentTrack is not None:
                         currentTrackpath = self.player.currentTrack.get_path().to_string()
                         if row.path is not None and row.path.to_string() == currentTrackpath:


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