[gnome-music/wip/gbsneto/contained-playlists: 2/29] playlist: Turns python-specific fields into GObject properties



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

    playlist: Turns 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 |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 6aed885..1f11b31 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -42,11 +42,13 @@ logger = logging.getLogger(__name__)
 
 class Playlist(GObject.Object):
     """ Base class of static and intelligent playlists """
-    ID = None
-    QUERY = None
-    TAG_TEXT = ""
-    TITLE = ""
 
+    __gproperties__ = {
+        'id': (str, 'Identifier', 'id', '', GObject.ParamFlags.READWRITE),
+        'query': (str, 'Query', 'query', '', GObject.ParamFlags.READWRITE),
+        'tag_text': (str, 'Tag', 'tag', '', GObject.ParamFlags.READWRITE),
+        'title': (str, 'Title', 'title', '', GObject.ParamFlags.READWRITE),
+    }
 
 class StaticPlaylists:
 


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