2012-04-04 5 views
0

プラグインをGnome 3の新しいgeditに転送したいのですが(Gnome 2 Geditから来ています)、すべて動作しているわけではありません。geditプラグインをgnome2バージョンからgnome3バージョンに簡単に変換できますか?

〜/、gnome2/geditを〜/ .local/share/geditに変更しました。* .gedit-pluginから* .pluginにすべて名前を変更しました。 [Gedit Plugin]から[Plugin]までのファイルに保存されます。環境設定のプラグインタブに表示されますが、有効にするとエラーになります。

単純な修正はありますか?

答えて

3

pythonを使用すると、実際にはそれほど難しくありません。あなたはすでに.pluginファイルを変換しています。 Pythonのファイルでは、これは典型的な差分である:

-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) 

私はいくつかの時間前に6つのプラグインを変換し、これらは私が必要な変更のみでした。

+0

ニース。私が扱っているプラ​​グインはちょっと難しいようです。http://pastie.org/3725963 ...それはただ一つのファイルです! – trusktr

+0

ほとんどの場合、GObject Instrospectionを使用し、Jensが提案した方法を調整する必要があります。 – gpoo

+0

ありがとうございます。私はそれを試してみましょう。ところで、jensや@gpooのように、変換したプラグインを私に送信して、変換したいプラグインがあるかどうかを確認できますか?私のGmail:trusktrありがとう! – trusktr

関連する問題