[fractal] fractal-gtk: message widget: Mark edited messages



commit 16bed1112311208cec4aa4ae3713b67d076d3041
Author: Juraj Fiala <jurf riseup net>
Date:   Tue Jun 30 18:36:47 2020 +0200

    fractal-gtk: message widget: Mark edited messages

 fractal-gtk/res/app.css            |  4 ++++
 fractal-gtk/src/widgets/message.rs | 37 ++++++++++++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/fractal-gtk/res/app.css b/fractal-gtk/res/app.css
index 159b2cd3..1e60f24a 100644
--- a/fractal-gtk/res/app.css
+++ b/fractal-gtk/res/app.css
@@ -208,6 +208,10 @@ row.msg-emote,
   color: @theme_selected_bg_color;
 }
 
+row .edit-mark {
+  opacity: 0.25;
+}
+
 .divider separator {
   background: @theme_selected_bg_color;
 }
diff --git a/fractal-gtk/src/widgets/message.rs b/fractal-gtk/src/widgets/message.rs
index 172393fb..d0d0de37 100644
--- a/fractal-gtk/src/widgets/message.rs
+++ b/fractal-gtk/src/widgets/message.rs
@@ -203,11 +203,11 @@ impl MessageBox {
         small: bool,
     ) -> gtk::Box {
         // content
-        // +------+
-        // | info |
-        // +------+
-        // | body |
-        // +------+
+        // +---------+
+        // | info    |
+        // +---------+
+        // | body_bx |
+        // +---------+
         let content = gtk::Box::new(gtk::Orientation::Vertical, 0);
 
         if !small {
@@ -217,6 +217,19 @@ impl MessageBox {
             content.pack_start(&info, false, false, 0);
         }
 
+        let body_bx = self.build_room_msg_body_bx(thread_pool, msg);
+        content.pack_start(&body_bx, true, true, 0);
+
+        content
+    }
+
+    fn build_room_msg_body_bx(&mut self, thread_pool: ThreadPool, msg: &Message) -> gtk::Box {
+        // body_bx
+        // +------+-----------+
+        // | body | edit_mark |
+        // +------+-----------+
+        let body_bx = gtk::Box::new(gtk::Orientation::Horizontal, 0);
+
         let body = match msg.mtype {
             RowType::Sticker => self.build_room_msg_sticker(thread_pool, msg),
             RowType::Image => self.build_room_msg_image(thread_pool, msg),
@@ -227,9 +240,19 @@ impl MessageBox {
             _ => self.build_room_msg_body(msg),
         };
 
-        content.pack_start(&body, true, true, 0);
+        body_bx.pack_start(&body, true, true, 0);
 
-        content
+        if msg.msg.replace != None {
+            let edit_mark = gtk::Image::new_from_icon_name(
+                Some("document-edit-symbolic"),
+                gtk::IconSize::Button,
+            );
+            edit_mark.get_style_context().add_class("edit-mark");
+            edit_mark.set_valign(gtk::Align::End);
+
+            body_bx.pack_start(&edit_mark, false, false, 0);
+        }
+        body_bx
     }
 
     fn build_room_msg_avatar(


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