[gnome-music/wip/jfelder/smartplaylist-update-sorted: 2/3] coremodel: Bind old song state on player playlist changes



commit ec3b2b7dbd03d086be01e476acb1c72e26c34ac5
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Mar 1 19:21:39 2020 +0100

    coremodel: Bind old song state on player playlist changes
    
    When a playlist is updated, it may already be playing. In that case,
    the state property from the previous instance of the song needs to be
    preserved.
    
    This issue is fixed by reversing the binding and making it
    bidirectional.

 gnomemusic/coremodel.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 20b7ecb9..5596e1ee 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -250,9 +250,10 @@ class CoreModel(GObject.GObject):
                         coresong.props.media, self._coreselection,
                         self.props.grilo)
 
-                    song.bind_property(
-                        "state", coresong, "state",
-                        GObject.BindingFlags.SYNC_CREATE)
+                    coresong.bind_property(
+                        "state", song, "state",
+                        GObject.BindingFlags.BIDIRECTIONAL
+                        | GObject.BindingFlags.SYNC_CREATE)
                     coresong.bind_property(
                         "validation", song, "validation",
                         GObject.BindingFlags.BIDIRECTIONAL


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