[fractal] fractal-gtk: Send redaction events



commit d5214a1d5ec039406f86dad1774188658e97c37f
Author: Christopher Davis <brainblasted disroot org>
Date:   Sat Oct 26 01:09:42 2019 -0700

    fractal-gtk: Send redaction events
    
    When moving our architecture to using GAction, the delete
    action was forgotten. This meant that while "Delete Message"
    showed in the UI, the button did nothing.
    
    Fixes #515

 fractal-gtk/res/ui/message_menu.ui      | 1 +
 fractal-gtk/src/actions/room_history.rs | 8 ++++++++
 2 files changed, 9 insertions(+)
---
diff --git a/fractal-gtk/res/ui/message_menu.ui b/fractal-gtk/res/ui/message_menu.ui
index 27391180..e3203359 100644
--- a/fractal-gtk/res/ui/message_menu.ui
+++ b/fractal-gtk/res/ui/message_menu.ui
@@ -122,6 +122,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
+            <property name="action_name">room_history.delete</property>
             <property name="text" translatable="yes">Delete Message</property>
           </object>
           <packing>
diff --git a/fractal-gtk/src/actions/room_history.rs b/fractal-gtk/src/actions/room_history.rs
index b56efc64..c5ac5dc7 100644
--- a/fractal-gtk/src/actions/room_history.rs
+++ b/fractal-gtk/src/actions/room_history.rs
@@ -167,6 +167,14 @@ pub fn new(backend: Sender<BKCommand>, server_url: Url, ui: UI) -> gio::SimpleAc
         }
     });
 
+    let b = backend.clone();
+    let u = server_url.clone();
+    delete.connect_activate(move |_, data| {
+        if let Some(m) = get_message(data) {
+            let _ = b.send(BKCommand::SendMsgRedaction(u.clone(), m));
+        }
+    });
+
     load_more_messages.connect_activate(clone!(server_url => move |_, data| {
         let id = get_room_id(data);
         request_more_messages(&backend, server_url.clone(), id);


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