Browse Source

event-details-dialog: Add button to open sender profile instead of copying the user ID

af/unable-to-decryt-styling
Kévin Commaille 12 months ago
parent
commit
2a5da4b12e
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 1
      data/resources/icons/scalable/status/user-info-symbolic.svg
  2. 1
      data/resources/resources.gresource.xml
  3. 14
      src/session/view/event_details_dialog.rs
  4. 19
      src/session/view/event_details_dialog.ui

1
data/resources/icons/scalable/status/user-info-symbolic.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g color="#bebebe" fill="#2e3436"><path d="M6 0a3 3 0 100 6 3 3 0 000-6zM4.5 7A4.49 4.49 0 000 11.5v.5c0 1 1 1 1 1h6V8.875c0-.83.587-1.554 1.355-1.79A4.532 4.532 0 007.5 7zM9 9v4h1V9z" style="marker:none" overflow="visible"/><path d="M8.875 8A.863.863 0 008 8.875v6.25c0 .492.383.875.875.875h6.25a.863.863 0 00.875-.875v-6.25A.863.863 0 0015.125 8zM11 9h2v1h-2zm0 2h2v4h-2z" style="marker:none" overflow="visible"/></g></svg>

After

Width:  |  Height:  |  Size: 488 B

1
data/resources/resources.gresource.xml

@ -61,6 +61,7 @@
<file preprocess="xml-stripblanks">icons/scalable/status/sync-off-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/sync-off-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/sync-on-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/sync-on-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/sync-partial-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/sync-partial-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/user-info-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/users-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/users-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/verified-danger-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/verified-danger-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/status/verified-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/status/verified-symbolic.svg</file>

14
src/session/view/event_details_dialog.rs

@ -4,7 +4,7 @@ use gtk::{glib, CompositeTemplate};
use sourceview::prelude::*; use sourceview::prelude::*;
use crate::{ use crate::{
components::{CopyableRow, ToastableDialog}, components::{CopyableRow, ToastableDialog, UserProfileDialog},
prelude::*, prelude::*,
session::model::Event, session::model::Event,
toast, utils, toast, utils,
@ -82,6 +82,18 @@ mod imp {
self.navigation_view.push_by_tag("source"); self.navigation_view.push_by_tag("source");
} }
/// Open the profile of the sender.
#[template_callback]
fn open_sender_profile(&self) {
let Some(sender) = self.event.borrow().as_ref().map(Event::sender) else {
return;
};
let dialog = UserProfileDialog::new();
dialog.set_room_member(sender);
dialog.present(Some(&*self.obj()));
}
/// View the original source. /// View the original source.
#[template_callback] #[template_callback]
fn show_original_source(&self) { fn show_original_source(&self) {

19
src/session/view/event_details_dialog.ui

@ -88,16 +88,27 @@
</object> </object>
</child> </child>
<child> <child>
<object class="CopyableRow" id="sender_id_row"> <object class="AdwActionRow" id="sender_id_row">
<property name="main-title">subtitle</property>
<property name="title" translatable="yes">Sender ID</property> <property name="title" translatable="yes">Sender ID</property>
<binding name="subtitle"> <binding name="subtitle">
<lookup name="sender-id-string"> <lookup name="sender-id-string">
<lookup name="event">EventDetailsDialog</lookup> <lookup name="event">EventDetailsDialog</lookup>
</lookup> </lookup>
</binding> </binding>
<property name="copy-button-tooltip-text" translatable="yes">Copy Sender ID</property> <style>
<property name="toast-text" translatable="yes">Sender ID copied to clipboard</property> <class name="property"/>
</style>
<child>
<object class="GtkButton">
<property name="valign">center</property>
<property name="icon-name">user-info-symbolic</property>
<property name="tooltip-text">View Profile</property>
<signal name="clicked" handler="open_sender_profile" swapped="yes"/>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object> </object>
</child> </child>
<child> <child>

Loading…
Cancel
Save