[gnome-music/wip/mschraal/playlists-fixes: 2/5] coremodel: Bind player model state bidirectional



commit 5f982488378ac7de6a9b2d7e72f2c3b8007a497b
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Mar 1 22:58:22 2020 +0100

    coremodel: Bind player model state bidirectional
    
    The player model needs to set state towards the main playlist model to
    keep the different CoreSong's in sync.
    
    Make the binding between the coresongs bidirectional.

 gnomemusic/coremodel.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index be395d07..ef286bb1 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -240,9 +240,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
@@ -284,9 +285,10 @@ class CoreModel(GObject.GObject):
                     self.props.grilo)
 
                 songs_added.append(song)
-                song.bind_property(
-                    "state", model_song, "state",
-                    GObject.BindingFlags.SYNC_CREATE)
+                model_song.bind_property(
+                    "state", song, "state",
+                    GObject.BindingFlags.BIDIRECTIONAL
+                    | GObject.BindingFlags.SYNC_CREATE)
                 model_song.bind_property(
                     "validation", song, "validation",
                     GObject.BindingFlags.BIDIRECTIONAL


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