[gnome-music/wip/mschraal/core: 53/93] Set state



commit c8e8480b9e2d9ddc9ee031c4fa539eae1f5b9e11
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jun 2 18:53:20 2019 +0200

    Set state

 gnomemusic/coresong.py                  | 3 +--
 gnomemusic/widgets/disclistboxwidget.py | 4 ++++
 gnomemusic/widgets/songwidget.py        | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/coresong.py b/gnomemusic/coresong.py
index efc5aa9b..530098e1 100644
--- a/gnomemusic/coresong.py
+++ b/gnomemusic/coresong.py
@@ -19,8 +19,7 @@ class CoreSong(GObject.GObject):
     media = GObject.Property(type=Grl.Media)
     play_count = GObject.Property(type=int)
     selected = GObject.Property(type=bool, default=False)
-    state = GObject.Property(
-        type=int, default=SongWidget.State.UNPLAYED)
+    state = GObject.Property()  # FIXME: How to set an IntEnum type?
     title = GObject.Property(type=str)
     track_number = GObject.Property(type=int)
     url = GObject.Property(type=str)
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 364d46f8..9ff2af38 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -212,6 +212,10 @@ class DiscBox(Gtk.Box):
             "selected", song_widget, "selected",
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)
+        song.bind_property(
+            "state", song_widget, "state",
+            GObject.BindingFlags.BIDIRECTIONAL
+            | GObject.BindingFlags.SYNC_CREATE)
 
         song_widget.connect('button-release-event', self._song_activated)
 
diff --git a/gnomemusic/widgets/songwidget.py b/gnomemusic/widgets/songwidget.py
index 7ef59f81..93971353 100644
--- a/gnomemusic/widgets/songwidget.py
+++ b/gnomemusic/widgets/songwidget.py
@@ -201,6 +201,7 @@ class SongWidget(Gtk.EventBox):
 
         :param SongWidget.State value: Widget state
         """
+        print("STATE CHANGE")
         self._state = value
 
         style_ctx = self._title_label.get_style_context()


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