[fractal/clippy-ci: 24/25] Display file name of audio messages



commit 4c65d8538128a1aa403234d8cfb66795cf523c3a
Author: Sonja Heinze <sonjaleaheinze gmail com>
Date:   Thu Feb 20 19:08:42 2020 +0100

    Display file name of audio messages
    
    With this commit, the file name of an audio message gets displayed above
    the audio player.

 fractal-gtk/res/app.css            |  7 +++++++
 fractal-gtk/src/widgets/message.rs | 13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/fractal-gtk/res/app.css b/fractal-gtk/res/app.css
index 39c2ac67..c65afe8e 100644
--- a/fractal-gtk/res/app.css
+++ b/fractal-gtk/res/app.css
@@ -24,6 +24,13 @@
   padding: 6px 0px;
 }
 
+.audio-box {
+  margin-top: 6px;
+  border: 1px solid lightgray;
+  border-radius: 10px;
+  padding: 12px;
+}
+
 .noroom-title {
   font-size: larger;
   opacity: 0.5;
diff --git a/fractal-gtk/src/widgets/message.rs b/fractal-gtk/src/widgets/message.rs
index 12818320..b79f46b9 100644
--- a/fractal-gtk/src/widgets/message.rs
+++ b/fractal-gtk/src/widgets/message.rs
@@ -5,7 +5,7 @@ use chrono::prelude::*;
 use fractal_api::url::Url;
 use glib;
 use gtk;
-use gtk::{prelude::*, ButtonExt, ContainerExt, Overlay, WidgetExt};
+use gtk::{prelude::*, ButtonExt, ContainerExt, LabelExt, Overlay, WidgetExt};
 use pango;
 use std::cmp::max;
 use std::rc::Rc;
@@ -423,7 +423,16 @@ impl MessageBox {
             .expect("Every AudioPlayer must have controls.");
         bx.pack_start(&control_box, false, true, 0);
         bx.pack_start(&download_btn, false, false, 3);
-        bx
+
+        let outer_box = gtk::Box::new(gtk::Orientation::Vertical, 6);
+        let file_name = gtk::Label::new(Some(&format!("<b>{}</b>", msg.body)));
+        file_name.set_use_markup(true);
+        file_name.set_xalign(0.0);
+        file_name.set_line_wrap(true);
+        outer_box.pack_start(&file_name, false, false, 0);
+        outer_box.pack_start(&bx, false, false, 0);
+        outer_box.get_style_context().add_class("audio-box");
+        outer_box
     }
 
     fn build_room_video_player(&mut self, msg: &Message) -> gtk::Box {


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