[gedit-plugins/metatada] Translate plugin: allow to disable / enable without duplication the menu and bottom window
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/metatada] Translate plugin: allow to disable / enable without duplication the menu and bottom window
- Date: Fri, 3 May 2019 17:54:05 +0000 (UTC)
commit 565a3fe54b9e098d032311b5c0d45a3120747f39
Author: Jordi Mas <jmas softcatala org>
Date: Fri May 3 19:53:46 2019 +0200
Translate plugin: allow to disable / enable without duplication the menu and bottom window
plugins/translate/translate/__init__.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/plugins/translate/translate/__init__.py b/plugins/translate/translate/__init__.py
index 6c0cae9..394d724 100644
--- a/plugins/translate/translate/__init__.py
+++ b/plugins/translate/translate/__init__.py
@@ -76,6 +76,8 @@ class TranslateWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGt
bottom.add_titled(g_console, "GeditTranslateConsolePanel", _('Translate Console'))
def do_deactivate(self):
+ bottom = self.window.get_bottom_panel()
+ bottom.remove(g_console)
self.window.remove_action("translate")
def do_update_state(self):
@@ -123,14 +125,18 @@ class TranslateViewActivatable(GObject.Object, Gedit.ViewActivatable):
view = GObject.Property(type=Gedit.View)
def __init__(self):
+ self.popup_handler_id = 0
GObject.Object.__init__(self)
self._settings = Settings()
def do_activate(self):
self.view.translate_view_activatable = self
- self.view.connect('populate-popup', self.populate_popup)
+ self.popup_handler_id = self.view.connect('populate-popup', self.populate_popup)
def do_deactivate(self):
+ if self.popup_handler_id != 0:
+ self.view.disconnect(self.popup_handler_id)
+ self.popup_handler_id = 0
delattr(self.view, "translate_view_activatable")
def _get_language_pair_name(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]