[gnome-music/wip/gbsneto/contained-playlists: 30/35] playlist: Add property getters and setters



commit 9736c1585b5a2617313d4e3074f016588b5e9056
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 1 20:24:34 2016 -0200

    playlist: Add property getters and setters
    
    So we can bind these properties.

 gnomemusic/playlists.py |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index f64a80c..9a2dda0 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -62,6 +62,38 @@ class Playlist(GObject.Object):
         self.title = title
         self.is_static = False
 
+    @log
+    def do_get_property(self, property):
+        if property.name == 'id':
+            return self.id
+        elif property.name == 'query':
+            return self.query
+        elif property.name == 'tag_text':
+            return self.tag_text
+        elif property.name == 'title':
+            return self.title
+        elif property.name == 'is_static':
+            return self.is_static
+        else:
+            raise AttributeError('Unknown property %s' % property.name)
+
+    @log
+    def do_set_property(self, property, value):
+        if property.name == 'id':
+            self.id = value
+        elif property.name == 'query':
+            self.query = value
+        elif property.name == 'tag_text':
+            self.tag_text = value
+        elif property.name == 'title':
+            self.title = value
+        elif property.name == 'is_static':
+            self.is_static = value
+        else:
+            raise AttributeError('Unknown property %s' % property.name)
+
+        self.notify(property.name)
+
 
 class StaticPlaylist(Playlist):
     """Base class for static playlists"""


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