[totem] plugins: Fix python plugins' init of self.totem



commit 5f7f6ca154d8828b579aa880f24c6190ff26eff8
Author: Sebastian Pölsterl <sebp k-d-w org>
Date:   Sat Mar 26 12:26:07 2011 +0100

    plugins: Fix python plugins' init of self.totem
    
    Retrieve "object" property containing the TotemObject in
    do_activate instead of __init__, because in the latter
    case it would be None.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645687

 src/plugins/coherence_upnp/coherence_upnp.py |    3 ++-
 src/plugins/iplayer/iplayer.py               |    3 ++-
 src/plugins/jamendo/jamendo.py               |    3 ++-
 src/plugins/opensubtitles/opensubtitles.py   |    3 ++-
 src/plugins/pythonconsole/pythonconsole.py   |    3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/coherence_upnp/coherence_upnp.py b/src/plugins/coherence_upnp/coherence_upnp.py
index 29d74d5..d785830 100644
--- a/src/plugins/coherence_upnp/coherence_upnp.py
+++ b/src/plugins/coherence_upnp/coherence_upnp.py
@@ -23,7 +23,7 @@ class UPnPClient(gobject.GObject, Peas.Activatable):
     object = gobject.property(type = gobject.GObject)
 
     def __init__ (self):
-        self.totem_object = self.object
+        self.totem_object = None
         self.ui = TreeWidget()
         self.ui.window.set_shadow_type(gtk.SHADOW_IN)
         self.ui.cb_item_right_click = self.button_pressed
@@ -113,6 +113,7 @@ class UPnPClient(gobject.GObject, Peas.Activatable):
             self.context = self.context_no_delete
 
     def do_activate (self):
+        self.totem_object = self.object
         self.totem_object.add_sidebar_page ("upnp-coherence", _(u"Coherence DLNA/UPnP Client"), self.ui.window)
 
         def load_and_play(url):
diff --git a/src/plugins/iplayer/iplayer.py b/src/plugins/iplayer/iplayer.py
index ae86284..26baea0 100644
--- a/src/plugins/iplayer/iplayer.py
+++ b/src/plugins/iplayer/iplayer.py
@@ -20,10 +20,11 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
 
 	def __init__ (self):
 		self.debug = False
-		self.totem = self.object
+		self.totem = None
 		self.programme_download_lock = threading.Lock ()
 
 	def do_activate (self):
+		self.totem = self.object
 		# Build the interface
 		builder = Totem.plugin_load_interface ("iplayer", "iplayer.ui", True, self.totem.get_main_window (), self)
 		container = builder.get_object ('iplayer_vbox')
diff --git a/src/plugins/jamendo/jamendo.py b/src/plugins/jamendo/jamendo.py
index 17af39c..5619cf3 100644
--- a/src/plugins/jamendo/jamendo.py
+++ b/src/plugins/jamendo/jamendo.py
@@ -80,7 +80,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
     def __init__(self):
         self.debug = True
         self.gstreamer_plugins_present = True
-        self.totem = self.object
+        self.totem = None
         self.settings = Gio.Settings.new ('org.gnome.totem.plugins.jamendo')
         self.settings.connect ('changed::format', self.on_format_changed)
         self.settings.connect ('changed::num-per-page', self.on_num_per_page_changed)
@@ -89,6 +89,7 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasGtk.Configurable):
         """
         Plugin activation.
         """
+        self.totem = self.object
         # Initialise the interface
         builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, self.totem.get_main_window (), self)
         self.popup = builder.get_object('popup_menu')
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 7fa98b6..791cc67 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -302,7 +302,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
 
     def __init__(self):
         self.dialog = None
-        self.totem = self.object
+        self.totem = None
         self.settings = Gio.Settings.new ('org.gnome.totem.plugins.opensubtitles')
 
     # totem.Plugin methods
@@ -313,6 +313,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
         Here the sidebar page is initialized(set up the treeview, connect 
         the callbacks, ...) and added to totem.
         """
+        self.totem = self.object
 	self.filename = None
 
         self.manager = self.totem.get_ui_manager()
diff --git a/src/plugins/pythonconsole/pythonconsole.py b/src/plugins/pythonconsole/pythonconsole.py
index 7929e96..ec18756 100644
--- a/src/plugins/pythonconsole/pythonconsole.py
+++ b/src/plugins/pythonconsole/pythonconsole.py
@@ -72,10 +72,11 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
 	object = gobject.property(type = gobject.GObject)
 
 	def __init__(self):
-		self.totem = self.object
+		self.totem = None
 		self.window = None
 	
 	def do_activate(self):
+		self.totem = self.object
 
 		data = dict()
 		manager = self.totem.get_ui_manager()



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