[gedit-plugins/gnome-3-32] Translate plugin: enable/disable without duplicating the bottom panel and the menu entry
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/gnome-3-32] Translate plugin: enable/disable without duplicating the bottom panel and the menu entry
- Date: Mon, 6 May 2019 18:53:16 +0000 (UTC)
commit 7b297a557d8cc4f2e87500136a3bbf029a658df4
Author: Jordi Mas <jmas softcatala org>
Date: Fri May 3 19:56:55 2019 +0200
Translate plugin: enable/disable without duplicating the bottom panel and the menu entry
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]