From cea15bd094194c5d4603acaf227e4a4fc1b1e847 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Wed, 30 Dec 2020 12:00:00 +0000
Subject: [PATCH] Remove send button

With an eventually upcoming file attachment button (and separate voice
button) the UI might become too clunky with a send button. In addition,
no other major desktop chatting program seems to have one, since sending
via pressing enter is the standard.

Basically reverts 6b9f691c4eb811ef2
---
 briar-gtk/briar_gtk/actions/window.py         | 10 -----
 briar-gtk/briar_gtk/presenters/main_window.py |  4 --
 .../briar_gtk/presenters/private_chat.py      |  9 ----
 briar-gtk/data/ui/main_window.ui              | 41 +++----------------
 4 files changed, 6 insertions(+), 58 deletions(-)

diff --git a/briar-gtk/briar_gtk/actions/window.py b/briar-gtk/briar_gtk/actions/window.py
index 5edf1cd..e853349 100644
--- a/briar-gtk/briar_gtk/actions/window.py
+++ b/briar-gtk/briar_gtk/actions/window.py
@@ -31,7 +31,6 @@ class WindowActions(Actions):
         self._setup_open_emoji_menu_action()
         self._setup_open_main_window_action()
         self._setup_open_private_chat_action()
-        self._setup_send_message_action()
 
     def _setup_back_to_sidebar_action(self):
         self._setup_action("back-to-sidebar", None, self._back_to_sidebar)
@@ -67,9 +66,6 @@ class WindowActions(Actions):
         self._setup_action("open-private-chat", GLib.VariantType.new("i"),
                            self._open_private_chat)
 
-    def _setup_send_message_action(self):
-        self._setup_action("send-message", None, self._send_message)
-
     # pylint: disable=unused-argument
     def _back_to_sidebar(self, action, parameter):
         if not isinstance(self.widget.current_view, MainWindowView):
@@ -122,9 +118,3 @@ class WindowActions(Actions):
                 "Should open private chat only from MainWindowView")
         self.widget.current_view.presenter.open_private_chat(
             contact_id.get_int32())
-
-    # pylint: disable=unused-argument
-    def _send_message(self, action, parameter):
-        if not isinstance(self.widget.current_view, MainWindowView):
-            raise Exception("Should send message only from MainWindowView")
-        self.widget.current_view.presenter.send_message()
diff --git a/briar-gtk/briar_gtk/presenters/main_window.py b/briar-gtk/briar_gtk/presenters/main_window.py
index 511b1e7..59a0e3f 100644
--- a/briar-gtk/briar_gtk/presenters/main_window.py
+++ b/briar-gtk/briar_gtk/presenters/main_window.py
@@ -53,10 +53,6 @@ class MainWindowPresenter:
             self._view.builder, contact_id, self._sidebar_presenter)
         self._private_chat_presenter = private_chat_view.presenter
 
-    def send_message(self):
-        if isinstance(self._private_chat_presenter, PrivateChatPresenter):
-            self._private_chat_presenter.send_message()
-
     def _setup_destroy_listener(self):
         self._view.connect("destroy", self._on_destroy)
 
diff --git a/briar-gtk/briar_gtk/presenters/private_chat.py b/briar-gtk/briar_gtk/presenters/private_chat.py
index d6b916a..57f43fb 100644
--- a/briar-gtk/briar_gtk/presenters/private_chat.py
+++ b/briar-gtk/briar_gtk/presenters/private_chat.py
@@ -103,15 +103,6 @@ class PrivateChatPresenter:
         self._hide_chat_menu_button()
         self._disconnect_chat_entry_signals()
 
-    def send_message(self):
-        chat_entry = self._view.builder.get_object("chat_entry")
-        # Text does not only contain whitespace
-        if len(self._get_text_from_text_view(chat_entry).strip()) == 0:
-            return False
-        self._send_message(chat_entry)
-        self._sidebar_presenter.refresh_contacts()
-        return True
-
     def disconnect_signals(self):
         for signal in self._signals:
             APP().api.socket_listener.disconnect(signal)
diff --git a/briar-gtk/data/ui/main_window.ui b/briar-gtk/data/ui/main_window.ui
index e7c8b38..f9e59aa 100644
--- a/briar-gtk/data/ui/main_window.ui
+++ b/briar-gtk/data/ui/main_window.ui
@@ -125,39 +125,10 @@
                                 <child>
                                   <object class="GtkBox">
                                     <property name="visible">True</property>
-                                    <child>
-                                      <object class="GtkButton" id="entry_emoji_button">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="margin-top">3</property>
-                                        <property name="margin-bottom">3</property>
-                                        <property name="vexpand">False</property>
-                                        <property name="valign">start</property>
-                                        <property name="relief">none</property>
-                                        <property name="action_name">win.open-emoji-menu</property>
-                                        <child>
-                                          <object class="GtkImage">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="icon_name">face-smile-symbolic</property>
-                                          </object>
-                                        </child>
-                                        <accessibility>
-
-                                        </accessibility>
-                                        <child internal-child="accessible">
-                                          <object class="AtkObject" id="a11y-entry_emoji_button">
-                                            <property name="AtkObject::accessible_name" translatable="yes">Show emojis</property>
-                                          </object>
-                                        </child>
-                                        <style>
-                                          <class name="message-input-button" />
-                                        </style>
-                                      </object>
-                                    </child>
                                     <child>
                                       <object class="GtkScrolledWindow">
                                         <property name="visible">True</property>
+                                        <property name="margin">6</property>
                                         <property name="propagate_natural_height">True</property>
                                         <property name="max_content_height">300</property>
                                         <child>
@@ -175,7 +146,7 @@
                                       </object>
                                     </child>
                                     <child>
-                                      <object class="GtkButton" id="entry_send_button">
+                                      <object class="GtkButton" id="entry_emoji_button">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="margin-top">3</property>
@@ -183,20 +154,20 @@
                                         <property name="vexpand">False</property>
                                         <property name="valign">start</property>
                                         <property name="relief">none</property>
-                                        <property name="action_name">win.send-message</property>
+                                        <property name="action_name">win.open-emoji-menu</property>
                                         <child>
                                           <object class="GtkImage">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="icon_name">media-playback-start</property>
+                                            <property name="icon_name">face-smile-symbolic</property>
                                           </object>
                                         </child>
                                         <accessibility>
 
                                         </accessibility>
                                         <child internal-child="accessible">
-                                          <object class="AtkObject" id="a11y-entry_send_button">
-                                            <property name="AtkObject::accessible_name" translatable="yes">Send</property>
+                                          <object class="AtkObject" id="a11y-entry_emoji_button">
+                                            <property name="AtkObject::accessible_name" translatable="yes">Show emojis</property>
                                           </object>
                                         </child>
                                         <style>
-- 
GitLab