[gnome-music/wip/mschraal/playlists-player-sync] coremodel: Listen to changed on playlists
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/playlists-player-sync] coremodel: Listen to changed on playlists
- Date: Mon, 2 Sep 2019 23:39:37 +0000 (UTC)
commit 291dff95fabb75e52fc8841048a3b73c8fe5708a
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Sep 3 01:36:17 2019 +0200
coremodel: Listen to changed on playlists
Playlists were mistakenly not handling live actions to the playlist and
passing them on to the PlayerPlaylist.
Have the player model react to 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]