[rhythmbox] sample-python: make it work, and make it a bit more interesting
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] sample-python: make it work, and make it a bit more interesting
- Date: Wed, 11 Jan 2012 08:50:04 +0000 (UTC)
commit a1aa7abe65f83d2c19711646514d717b60dfe6fe
Author: Jonathan Matthew <jonathan d14n org>
Date: Wed Jan 11 18:49:20 2012 +1000
sample-python: make it work, and make it a bit more interesting
plugins/sample-python/sample-python.py | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/plugins/sample-python/sample-python.py b/plugins/sample-python/sample-python.py
index 9fe4db1..e21fdee 100644
--- a/plugins/sample-python/sample-python.py
+++ b/plugins/sample-python/sample-python.py
@@ -6,6 +6,7 @@ gettext.install('rhythmbox', RB.locale_dir())
class SamplePython(GObject.Object, Peas.Activatable):
__gtype_name = 'SamplePythonPlugin'
+ object = GObject.property(type=GObject.GObject)
def __init__(self):
GObject.Object.__init__(self)
@@ -15,9 +16,11 @@ class SamplePython(GObject.Object, Peas.Activatable):
shell = self.object
db = shell.props.db
- model = db.query_model_new_empty()
- self.source = gobject.new (PythonSource, shell=shell, name=_("Python Source"), query_model=model)
- shell.append_source(self.source, None)
+ model = RB.RhythmDBQueryModel.new_empty(db)
+ self.source = GObject.new (PythonSource, shell=shell, name=_("Python Source"), query_model=model)
+ self.source.setup()
+ group = RB.DisplayPageGroup.get_by_id ("library")
+ shell.append_display_page(self.source, group)
def do_deactivate(self):
print "deactivating sample python plugin"
@@ -25,7 +28,17 @@ class SamplePython(GObject.Object, Peas.Activatable):
self.source = None
class PythonSource(RB.Source):
- def __init__(self):
- RB.Source.__init__(self)
+ def __init__(self, **kwargs):
+ super(PythonSource, self).__init__(kwargs)
+
+ def setup(self):
+ shell = self.props.shell
+ songs = RB.EntryView(db=shell.props.db, shell_player=shell.props.shell_player, is_drag_source=False, is_drag_dest=False)
+ songs.append_column(RB.EntryViewColumn.TITLE, True)
+ songs.set_model(self.props.query_model)
+ songs.show_all()
+ self.pack_start(songs, expand=True, fill=True, padding=0)
+
+
-GObject.type_register_dynamic(PythonSource)
+GObject.type_register(PythonSource)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]