I'd like to transfer my plugins to the new gedit in Gnome 3 (coming from Gnome 2 Gedit), but they don't all work.
I've changed their location from ~/,gnome2/gedit to ~/.local/share/gedit, and I've renamed all from *.gedit-plugin to *.plugin and I've changed the header in those files from [Gedit Plugin] to [Plugin]. I can see them now in the plugins tabs of the preferences, but enabling them results in an error.
Are there any simple fixes?
It is actually not that hard if you use python. You already converted the .plugin files. In the python files, this is a typical diff:
-import gtk
-import gedit
-import gobject
-import pango
+from gi.repository import Gtk, GObject, Gedit
.......
-class PluginName(gedit.Plugin):
+class PluginName(GObject.Object, Gedit.WindowActivatable):
+ window = GObject.property(type=Gedit.Window)
+
def __init__(self):
- gedit.Plugin.__init__(self)
+ GObject.Object.__init__(self)
self._instances = {}
- def activate(self, window):
- self._instances[window] = PluginNameWindowHelper(self, window)
+ def do_activate(self):
+ self._instances[self.window] = PluginNameWindowHelper(self, self.window)
+
+ def do_deactivate(self):
+ self._instances[self.window].deactivate()
+ del self._instances[self.window]
- def deactivate(self, window):
- self._instances[window].deactivate()
- del self._instances[window]
+ def do_update_state(self):
+ self._instances[self.window].update_ui()
- def update_ui(self, window):
- self._instances[window].update_ui()
.......
- self._action_group = gtk.ActionGroup("PluginNameActions")
+ self._action_group = Gtk.ActionGroup("PluginNameActions")
.......
- line = document.get_text(line_start, line_end)
+ line = document.get_text(line_start, line_end, False)
I converted 6 plugins some time ago, and these were the only changes I needed.