[gnome-music/wip/jfelder/fix-player-playist-reset-playing-state] coremodel: Remove playing state when changing player playlist



commit f1be314c6720600271ed1c7bd83efdffd4842154
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Sep 9 19:23:03 2019 +0200

    coremodel: Remove playing state when changing player playlist
    
    When changing the player playlist, the state of the coresongs from the
    current model are not updated. Thus, the playing state of the current
    model is unchanged. This means that the play icon of the current model
    will still be visible once an other model (album, artist, etc) is
    loaded (the PLAYING state will still be set).
    
    Fix the issue by removing the PLAYING state of the coresong from the
    current model before changing the player model.

 gnomemusic/coremodel.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 0df16163..0e8962e3 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -246,6 +246,11 @@ class CoreModel(GObject.GObject):
                         | GObject.BindingFlags.SYNC_CREATE)
 
         with model.freeze_notify():
+            for song in self._playlist_model:
+                if song.props.state == SongWidget.State.PLAYING:
+                    song.props.state = SongWidget.State.UNPLAYED
+                    break
+
             self._playlist_model.remove_all()
 
             if playlist_type == PlayerPlaylist.Type.ALBUM:


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