[gnome-music/wip/mschraal/playlists-player-sync: 3/3] coremodel: Listen to changes on playlists
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/playlists-player-sync: 3/3] coremodel: Listen to changes on playlists
- Date: Wed, 4 Sep 2019 08:38:15 +0000 (UTC)
commit bab56d6b5ce9808a98672c82e36a4398cde05688
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Sep 3 01:36:17 2019 +0200
coremodel: Listen to changes on playlists
Playlists were mistakenly not handling live actions to the playlist and
passing them on to the PlayerPlaylist model.
Have the PlayerPlaylist model react to active playlist model changes as
well.
gnomemusic/coremodel.py | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 80d8f25d..0df16163 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -79,6 +79,7 @@ class CoreModel(GObject.GObject):
super().__init__()
self._flatten_model = None
+ self._playlist_signal_id = None
self._previous_playlist_model = None
self._search_signal_id = None
self._song_signal_id = None
@@ -326,6 +327,10 @@ class CoreModel(GObject.GObject):
self.emit("playlist-loaded")
elif playlist_type == PlayerPlaylist.Type.PLAYLIST:
+ if self._playlist_signal_id:
+ self._previous_playlist_model.disconnect(
+ self._playlist_signal_id)
+
for model_song in model:
song = CoreSong(
model_song.props.media, self._coreselection,
@@ -341,6 +346,9 @@ class CoreModel(GObject.GObject):
GObject.BindingFlags.BIDIRECTIONAL
| GObject.BindingFlags.SYNC_CREATE)
+ self._playlist_signal_id = model.connect(
+ "items-changed", _on_items_changed)
+
self.emit("playlist-loaded")
self._previous_playlist_model = model
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]