[fractal/bilelmoussaoui/emoji-button] room history: Add an emoji selection button




commit 89a1970b27f1cf81fb44e4e1b1695a2df727c78c
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Mon Apr 11 22:36:01 2022 +0200

    room history: Add an emoji selection button
    
    It basically triggers the CTRL+. behavior

 data/resources/ui/content-room-history.ui | 8 +++++++-
 src/session/content/room_history/mod.rs   | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/data/resources/ui/content-room-history.ui b/data/resources/ui/content-room-history.ui
index cdf883f9e..3d3baa56f 100644
--- a/data/resources/ui/content-room-history.ui
+++ b/data/resources/ui/content-room-history.ui
@@ -250,6 +250,13 @@
                     </child>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkButton">
+                    <property name="valign">end</property>
+                    <property name="icon-name">emoji-people-symbolic</property>
+                    <property name="action-name">room-history.open-emoji</property>
+                  </object>
+                </child>
                 <child>
                   <object class="GtkButton">
                     <property name="valign">end</property>
@@ -270,4 +277,3 @@
     </child>
   </template>
 </interface>
-
diff --git a/src/session/content/room_history/mod.rs b/src/session/content/room_history/mod.rs
index a5fe8f8f1..24f45f854 100644
--- a/src/session/content/room_history/mod.rs
+++ b/src/session/content/room_history/mod.rs
@@ -137,6 +137,10 @@ mod imp {
             klass.install_action("room-history.select-file", None, move |widget, _, _| {
                 widget.select_file();
             });
+
+            klass.install_action("room-history.open-emoji", None, move |widget, _, _| {
+                widget.open_emoji();
+            });
         }
 
         fn instance_init(obj: &InitializingObject<Self>) {
@@ -763,6 +767,10 @@ impl RoomHistory {
         priv_.drag_overlay.set_drop_target(&target);
     }
 
+    fn open_emoji(&self) {
+        self.imp().message_entry.emit_insert_emoji();
+    }
+
     fn open_attach_dialog(&self, bytes: Vec<u8>, mime: mime::Mime, title: &str) {
         let window = self.root().unwrap().downcast::<gtk::Window>().unwrap();
         let dialog = AttachmentDialog::new(&window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]