[gnome-music/wip/jfelder/fix-player-playist-reset-playing-state: 2/2] coremodel: Reset states when changing player playlist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/fix-player-playist-reset-playing-state: 2/2] coremodel: Reset states when changing player playlist
- Date: Wed, 11 Sep 2019 12:49:27 +0000 (UTC)
commit 748bb31b825213a4ec4e3bd38857ce5fcd91a789
Author: Jean Felder <jfelder src gnome org>
Date: Mon Sep 9 19:23:03 2019 +0200
coremodel: Reset states when changing player playlist
When changing the player playlist, the state of the coresongs from the
current model are not updated. Thus, the playing are played states of
the current model are unchanged. For example; 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 and PLAYED states of the
coresongs 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..ef1d67e6 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():
+ played_states = [SongWidget.State.PLAYING, SongWidget.State.PLAYED]
+ for song in self._playlist_model:
+ if song.props.state in played_states:
+ song.props.state = SongWidget.State.UNPLAYED
+
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]