[rhythmbox/gobject-introspection: 10/34] port a few more plugins to gi, untested



commit 7d216cd01d5a0292d4d2832a595e54d8f127ae9c
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jul 10 22:06:29 2010 +1000

    port a few more plugins to gi, untested

 plugins/im-status/im-status/__init__.py   |   16 +++++++++-------
 plugins/replaygain/replaygain/__init__.py |    7 ++++---
 plugins/replaygain/replaygain/config.py   |   17 +++++++++--------
 plugins/replaygain/replaygain/player.py   |   12 ++++++------
 plugins/sample-python/sample-python.py    |   14 ++++++++------
 plugins/sendto/__init__.py                |   15 ++++++++-------
 6 files changed, 44 insertions(+), 37 deletions(-)
---
diff --git a/plugins/im-status/im-status/__init__.py b/plugins/im-status/im-status/__init__.py
index d551554..8408ea8 100644
--- a/plugins/im-status/im-status/__init__.py
+++ b/plugins/im-status/im-status/__init__.py
@@ -25,7 +25,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
-import rhythmdb, rb
+import gi.repository
+from gi.repository import Rhythmbox
+
 try:
   import dbus
   use_gossip = True
@@ -57,9 +59,9 @@ PURPLE_BUS_NAME = 'im.pidgin.purple.PurpleService'
 PURPLE_OBJ_PATH = '/im/pidgin/purple/PurpleObject'
 PURPLE_IFACE_NAME = 'im.pidgin.purple.PurpleInterface'
 
-class IMStatusPlugin (rb.Plugin):
+class IMStatusPlugin (Rhythmbox.RBPlugin):
   def __init__ (self):
-    rb.Plugin.__init__ (self)
+    Rhythmbox.RBPlugin.__init__ (self)
 
   def activate (self, shell):
     self.shell = shell
@@ -133,11 +135,11 @@ class IMStatusPlugin (rb.Plugin):
 
   def set_status_from_entry (self):
     db = self.shell.get_property ("db")
-    self.current_artist = db.entry_get (self.current_entry, rhythmdb.PROP_ARTIST)
-    self.current_title  = db.entry_get (self.current_entry, rhythmdb.PROP_TITLE)
-    self.current_album  = db.entry_get (self.current_entry, rhythmdb.PROP_ALBUM)
+    self.current_artist = db.entry_get (self.current_entry, Rhythmbox.RhythmDBPropType.ARTIST)
+    self.current_title  = db.entry_get (self.current_entry, Rhythmbox.RhythmDBPropType.TITLE)
+    self.current_album  = db.entry_get (self.current_entry, Rhythmbox.RhythmDBPropType.ALBUM)
 
-    if self.current_entry.get_entry_type().category == rhythmdb.ENTRY_STREAM:
+    if self.current_entry.get_entry_type().category == Rhythmbox.RhythmDBEntryCategory.STREAM:
       if not self.current_artist:
         self.current_artist = db.entry_request_extra_metadata (self.current_entry, STREAM_SONG_ARTIST)
       if not self.current_title:
diff --git a/plugins/replaygain/replaygain/__init__.py b/plugins/replaygain/replaygain/__init__.py
index 32563f8..e81c2ba 100644
--- a/plugins/replaygain/replaygain/__init__.py
+++ b/plugins/replaygain/replaygain/__init__.py
@@ -25,15 +25,16 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 #
 
-import rb
+import gi.repository
+from gi.repository import Rhythmbox
 
 from config import ReplayGainConfigDialog
 from player import ReplayGainPlayer
 
-class ReplayGainPlugin(rb.Plugin):
+class ReplayGainPlugin(Rhythmbox.RBPlugin):
 
 	def __init__ (self):
-		rb.Plugin.__init__ (self)
+		Rhythmbox.RBPlugin.__init__ (self)
 		self.config_dialog = None
 
 	def activate (self, shell):
diff --git a/plugins/replaygain/replaygain/config.py b/plugins/replaygain/replaygain/config.py
index adab6aa..c591a88 100644
--- a/plugins/replaygain/replaygain/config.py
+++ b/plugins/replaygain/replaygain/config.py
@@ -26,9 +26,10 @@
 #
 
 import gobject
-import gtk
-import gconf
-import rhythmdb, rb
+import gi.repository
+from gi.repository import Gtk
+from gi.repository import GConf
+from gi.repository import Rhythmbox
 
 GCONF_DIR = '/apps/rhythmbox/plugins/replaygain'
 
@@ -46,21 +47,21 @@ REPLAYGAIN_MODE_ALBUM = 1
 # to apply for tracks that aren't tagged
 AVERAGE_GAIN_SAMPLES = 10
 
-class ReplayGainConfigDialog(gtk.Dialog):
+class ReplayGainConfigDialog(Gtk.Dialog):
 	def __init__(self, plugin):
-		gtk.Dialog.__init__(self)
+		Gtk.Dialog.__init__(self)
 		self.set_border_width(12)
 
-		self.gconf = gconf.client_get_default()
+		self.gconf = GConf.Client.get_default()
 
 		ui_file = plugin.find_file("replaygain-prefs.ui")
-		self.builder = gtk.Builder()
+		self.builder = Gtk.Builder()
 		self.builder.add_from_file(ui_file)
 
 		content = self.builder.get_object("replaygain-prefs")
 		self.get_content_area().add(content)
 
-		self.add_action_widget(gtk.Button(stock=gtk.STOCK_CLOSE), 0)
+		self.add_action_widget(Gtk.Button(stock=gtk.STOCK_CLOSE), 0)
 		self.show_all()
 
 		label = self.builder.get_object("headerlabel")
diff --git a/plugins/replaygain/replaygain/player.py b/plugins/replaygain/replaygain/player.py
index fac3aa7..ce0b743 100644
--- a/plugins/replaygain/replaygain/player.py
+++ b/plugins/replaygain/replaygain/player.py
@@ -25,11 +25,11 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 #
 
-import gtk
-import gconf
-import gst
 import gobject
-import rhythmdb, rb
+import gst
+import gi.repository
+from gi.repository import GConf
+from gi.repository import Rhythmbox
 
 import config
 
@@ -46,12 +46,12 @@ class ReplayGainPlayer(object):
 
 		if len(missing) > 0:
 			msg = _("The GStreamer elements required for ReplayGain processing are not available. The missing elements are: %s") % ", ".join(missing)
-			rb.error_dialog(shell.props.window, _("ReplayGain GStreamer plugins not available"), msg)
+			Rhythmbox.error_dialog(shell.props.window, _("ReplayGain GStreamer plugins not available"), msg)
 			raise Exception(msg)
 
 		self.shell_player = shell.props.shell_player
 		self.player = self.shell_player.props.player
-		self.gconf = gconf.client_get_default()
+		self.gconf = GConf.Client.get_default()
 
 		self.gconf.add_dir(config.GCONF_DIR, preload=False)
 		self.gconf.notify_add(config.GCONF_KEYS['limiter'], self.limiter_changed_cb)
diff --git a/plugins/sample-python/sample-python.py b/plugins/sample-python/sample-python.py
index 6f2a459..ceaecca 100644
--- a/plugins/sample-python/sample-python.py
+++ b/plugins/sample-python/sample-python.py
@@ -1,10 +1,12 @@
-import rhythmdb, rb
-import gobject, gtk
 
-class SamplePython(rb.Plugin):
+import gobject
+import gi.repository
+from gi.repository import Rhythmbox
+
+class SamplePython(Rhythmbox.RBPlugin):
 
 	def __init__(self):
-		rb.Plugin.__init__(self)
+		Rhythmbox.RBPlugin.__init__(self)
 			
 	def activate(self, shell):
 		print "activating sample python plugin"
@@ -20,8 +22,8 @@ class SamplePython(rb.Plugin):
 		self.source = None
 
 
-class PythonSource(rb.Source):
+class PythonSource(Rhythmbox.RBSource):
 	def __init__(self):
-		rb.Source.__init__(self)
+		Rhythmbox.RBSource.__init__(self)
 		
 gobject.type_register(PythonSource)
diff --git a/plugins/sendto/__init__.py b/plugins/sendto/__init__.py
index fe9d1a2..168881e 100644
--- a/plugins/sendto/__init__.py
+++ b/plugins/sendto/__init__.py
@@ -24,9 +24,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
-import rb
-import gtk
 import glib
+import gi.repository
+from gi.repository import Gtk
+from gi.repository import Rhythmbox
 
 ui_definition = """
 <ui>
@@ -43,16 +44,16 @@ ui_definition = """
     </popup>
 </ui>"""
 
-class SendToPlugin (rb.Plugin):
+class SendToPlugin (Rhythmbox.RBPlugin):
     def __init__(self):
-        rb.Plugin.__init__(self)
+        Rhythmbox.RBPlugin.__init__(self)
 
     def activate(self, shell):
-        self.__action = gtk.Action('SendTo', _('Send to...'),
-                                _('Send files by mail, instant message...'), '')
+        self.__action = Gtk.Action(name='SendTo', label=_('Send to...'),
+                                tooltip=_('Send files by mail, instant message...'), '')
         self.__action.connect('activate', self.send_to, shell)
 
-        self.__action_group = gtk.ActionGroup('SendToActionGroup')
+        self.__action_group = Gtk.ActionGroup(name='SendToActionGroup')
         self.__action_group.add_action(self.__action)
         shell.get_ui_manager().insert_action_group(self.__action_group)
 



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