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



commit cd667d7c0959fe339a01a6cd8d45e5d5caf3d268
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]