From b538fa106ec2554cd5b0b82925a9c675f26093a2 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Wed, 20 Sep 2023 17:59:46 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20the=20menu=20hack=20for=20Gajim=20?= =?UTF-8?q?=E2=89=A51.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-manifest.json | 4 ++-- plugin.py | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/plugin-manifest.json b/plugin-manifest.json index abb39ae..834b1a7 100644 --- a/plugin-manifest.json +++ b/plugin-manifest.json @@ -14,8 +14,8 @@ "win32" ], "requirements": [ - "gajim>=1.5,<1.9" + "gajim>=1.6,<1.9" ], "short_name": "otrplugin", - "version": "0.5" + "version": "0.5.1" } diff --git a/plugin.py b/plugin.py index 141c998..2d071aa 100644 --- a/plugin.py +++ b/plugin.py @@ -56,7 +56,7 @@ class OTRPlugin(GajimPlugin): self.modules = [module] self.gui_extension_points = { 'encrypt' + self.encryption_name: (self._encrypt_message, None), - # 'message_actions_box': (self._message_actions_box_activate, self._message_actions_box_deactivate), + 'message_actions_box': (self._message_actions_box_activate, self._message_actions_box_deactivate), } self._menuitem = None @@ -69,15 +69,13 @@ class OTRPlugin(GajimPlugin): return grid._ui.encryption_menu_button.get_menu_model() def activate(self): - pass - # if app.window is not None: - # grid = self._get_grid() - # self._actions_hack_activate(grid) + if app.window is not None and self._menuitem is None: + grid = self._get_grid() + self._actions_hack_activate(grid) def deactivate(self): - pass - # grid = self._get_grid() - # self._actions_hack_deactivate(grid) + grid = self._get_grid() + self._actions_hack_deactivate(grid) @staticmethod def get_otr(account): @@ -109,7 +107,7 @@ class OTRPlugin(GajimPlugin): def _actions_hack_activate(self, grid): model = grid._ui.encryption_menu_button.get_menu_model() - menuitem = make_menu_item('OTR', 'win.set-encryption', '"OTR"') + menuitem = make_menu_item('OTR', 'win.set-encryption', 'OTR') self._menuitem = menuitem.get_attribute_value(Gio.MENU_ATTRIBUTE_LABEL) model.append_item(menuitem)