[gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 9/24] playlists: Turn python-specific fields into GObject properties



commit f2371dfb84a65a472ccffc024113542d8c581055
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Nov 28 18:12:45 2016 +0100

    playlists: Turn python-specific fields into GObject properties
    
    Now that Playlist is a GObject, we can have the old Python-specific
    fields turned into properties, which will allow us to e.g. notify
    when something changes, bind them with other widgets, among others.

 gnomemusic/playlists.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 3a888c90..1fd7d2cf 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -41,16 +41,23 @@ logger = logging.getLogger(__name__)
 
 class Playlist(GObject.GObject):
     """ Base class of all playlists """
-    ID = None
-    QUERY = None
-    TAG_TEXT = ""
-    TITLE = ""
+
+    pl_id = GObject.Property(type=str, default=None)
+    query = GObject.Property(type=str, default=None)
+    tag_text = GObject.Property(type=str, default=None)
+    title = GObject.Property(type=str, default=None)
 
     def __repr__(self):
         return "<Playlist>"
 
-    def __init__(self):
-        super().__init()
+    def __init__(self, pl_id=None, query=None, tag_text=None, title=None):
+        super().__init__()
+
+        self.props.pl_id = pl_id
+        self.props.query = query
+        self.props.tag_text = tag_text
+        self.props.title = title
+
 
 class SmartPlaylists:
 


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