From f303a4e468e6b75c9b8723d4a359320787c353d2 Mon Sep 17 00:00:00 2001 From: Nico Alt <nicoalt@posteo.org> Date: Wed, 30 Dec 2020 12:00:00 +0000 Subject: [PATCH] Make emoji button in chat input work --- briar-gtk/briar_gtk/actions/window.py | 10 ++++++++++ briar-gtk/briar_gtk/presenters/main_window.py | 4 ++++ briar-gtk/briar_gtk/presenters/private_chat.py | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/briar-gtk/briar_gtk/actions/window.py b/briar-gtk/briar_gtk/actions/window.py index 71f01f2..e853349 100644 --- a/briar-gtk/briar_gtk/actions/window.py +++ b/briar-gtk/briar_gtk/actions/window.py @@ -28,6 +28,7 @@ class WindowActions(Actions): self._setup_change_alias_contact_action() self._setup_open_about_page_action() self._setup_open_add_contact_action() + self._setup_open_emoji_menu_action() self._setup_open_main_window_action() self._setup_open_private_chat_action() @@ -55,6 +56,9 @@ class WindowActions(Actions): def _setup_open_add_contact_action(self): self._setup_action("open-add-contact", None, self._open_add_contact) + def _setup_open_emoji_menu_action(self): + self._setup_action("open-emoji-menu", None, self._open_emoji_menu) + def _setup_open_main_window_action(self): self._setup_action("open-main-window", None, self._open_main_window) @@ -97,6 +101,12 @@ class WindowActions(Actions): def _open_add_contact(self, action, parameter): self.widget.show_add_contact_view() + # pylint: disable=unused-argument + def _open_emoji_menu(self, action, parameter): + if not isinstance(self.widget.current_view, MainWindowView): + raise Exception("Should open emoji menu only from MainWindowView") + self.widget.current_view.presenter.open_emoji_menu() + # pylint: disable=unused-argument def _open_main_window(self, action, parameter): self.widget.show_main_window_view() diff --git a/briar-gtk/briar_gtk/presenters/main_window.py b/briar-gtk/briar_gtk/presenters/main_window.py index 4bafce6..59a0e3f 100644 --- a/briar-gtk/briar_gtk/presenters/main_window.py +++ b/briar-gtk/briar_gtk/presenters/main_window.py @@ -38,6 +38,10 @@ class MainWindowPresenter: if isinstance(self._private_chat_presenter, PrivateChatPresenter): self._private_chat_presenter.open_delete_contact_dialog() + def open_emoji_menu(self): + if isinstance(self._private_chat_presenter, PrivateChatPresenter): + self._private_chat_presenter.open_emoji_menu() + def close_private_chat(self): if isinstance(self._private_chat_presenter, PrivateChatPresenter): self._private_chat_presenter.close_private_chat() diff --git a/briar-gtk/briar_gtk/presenters/private_chat.py b/briar-gtk/briar_gtk/presenters/private_chat.py index ea4173e..2f6e41a 100644 --- a/briar-gtk/briar_gtk/presenters/private_chat.py +++ b/briar-gtk/briar_gtk/presenters/private_chat.py @@ -86,6 +86,10 @@ class PrivateChatPresenter: confirmation_dialog.connect("response", self._delete_contact) confirmation_dialog.show_all() + def open_emoji_menu(self): + chat_entry = self._view.builder.get_object("chat_entry") + chat_entry.emit("insert-emoji") + def close_private_chat(self): # formerly `show_sidebar` main_content_stack = self._view.builder.get_object( "main_content_stack") -- GitLab