[gedit/libgpe: 13/18] Implement a fallback in gedit.Plugin to use the old method names.



commit 2bd081548d6cabda0228f1541c2b1751ce982579
Author: Steve Frécinaux <code istique net>
Date:   Mon Nov 2 19:49:06 2009 +0100

    Implement a fallback in gedit.Plugin to use the old method names.
    
    New plugins are encouraged to use the regular gobject method overriding
    process, but as we are the kind type, we make sure the old plugins will
    likely work while still using the old way of doing things.

 bindings/python/__init__.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py
index 7373d06..acbf263 100644
--- a/bindings/python/__init__.py
+++ b/bindings/python/__init__.py
@@ -20,5 +20,23 @@
 # Import everything from the binary module
 from gedit._gedit import *
 
+import gobject
+from gedit import _gedit
+
+class Plugin(_gedit.Plugin):
+    def do_activate(self, window):
+        if hasattr(self, 'activate'):
+            self.activate(window)
+
+    def do_deactivate(self, window):
+        if hasattr(self, 'deactivate'):
+            self.deactivate(window)
+
+    def do_update_ui(self, window):
+        if hasattr(self, 'update_ui'):
+            self.update_ui(window)
+
+gobject.type_register(Plugin)
+
 # Make it harder to access the actual module...
 del _gedit



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