[totem/introspection: 12/17] Port coherence_upnp plugin to libpeas



commit c8674f3da9a3bb6879ae0efb8da855efafe826dd
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Jun 27 11:53:26 2010 +0100

    Port coherence_upnp plugin to libpeas
    
    The code has been ported, but the plugin has to be disabled as it depends on
    the Coherence library, which still uses PyGTK.

 configure.in                                 |    5 +++++
 src/plugins/coherence_upnp/coherence_upnp.py |   19 +++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/configure.in b/configure.in
index 16c137a..a3ad181 100644
--- a/configure.in
+++ b/configure.in
@@ -410,6 +410,11 @@ for plugin in ${used_plugins}; do
 	add_plugin="1"
 
 	case ${plugin} in
+		coherence_upnp)
+			# The Coherence framework still uses PyGTK, and thus conflicts with the new pygobject introspected bindings
+			plugin_error_or_ignore "the coherence_upnp plugin uses PyGTK and conflicts with the new pygobject bindings"
+			add_plugin="0"
+		;;
 		screensaver)
 			PKG_CHECK_MODULES(SCREENSAVER, gconf-2.0)
 		;;
diff --git a/src/plugins/coherence_upnp/coherence_upnp.py b/src/plugins/coherence_upnp/coherence_upnp.py
index 0f6d087..e1517df 100644
--- a/src/plugins/coherence_upnp/coherence_upnp.py
+++ b/src/plugins/coherence_upnp/coherence_upnp.py
@@ -3,19 +3,22 @@
 
 # Copyright 2008, Frank Scholz <coherence beebits net>
 
-import pygtk
-pygtk.require("2.0")
-import gtk
+from gi.repository import Peas
+from gi.repository import Gtk
+from gi.repository import Totem
 
 from coherence.ui.av_widgets import TreeWidget
 from coherence.ui.av_widgets import UDN_COLUMN,UPNP_CLASS_COLUMN,SERVICE_COLUMN
 
-import totem
+gettext.textdomain("totem")
 
-class UPnPClient(totem.Plugin):
+D_ = gettext.dgettext
+_ = gettext.gettext
+
+class UPnPClient(gobject.GObject, Peas.Activatable):
+    __gtype_name__ = 'UPnPClient'
 
     def __init__ (self):
-        totem.Plugin.__init__(self)
         self.ui = TreeWidget()
         self.ui.window.set_shadow_type(gtk.SHADOW_IN)
         self.ui.cb_item_right_click = self.button_pressed
@@ -104,7 +107,7 @@ class UPnPClient(totem.Plugin):
         else:
             self.context = self.context_no_delete
 
-    def activate (self, totem_object):
+    def do_activate (self, totem_object):
         totem_object.add_sidebar_page ("upnp-coherence", _("Coherence DLNA/UPnP Client"), self.ui.window)
         self.totem_object = totem_object
 
@@ -113,5 +116,5 @@ class UPnPClient(totem.Plugin):
 
         self.ui.cb_item_dbl_click = load_and_play
 
-    def deactivate (self, totem_object):
+    def do_deactivate (self, totem_object):
         totem_object.remove_sidebar_page ("upnp-coherence")



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