|
|
|
|
@ -11,8 +11,6 @@ use crate::{
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
mod imp { |
|
|
|
|
use std::cell::RefCell; |
|
|
|
|
|
|
|
|
|
use glib::subclass::InitializingObject; |
|
|
|
|
|
|
|
|
|
use super::*; |
|
|
|
|
@ -29,7 +27,6 @@ mod imp {
|
|
|
|
|
display_name: TemplateChild<gtk::Label>, |
|
|
|
|
#[template_child] |
|
|
|
|
notification_count: TemplateChild<gtk::Label>, |
|
|
|
|
direct_icon: RefCell<Option<gtk::Image>>, |
|
|
|
|
/// The room represented by this row.
|
|
|
|
|
#[property(get, set = Self::set_room, explicit_notify, nullable)] |
|
|
|
|
room: BoundObject<Room>, |
|
|
|
|
@ -108,13 +105,6 @@ mod imp {
|
|
|
|
|
imp.update_highlight(); |
|
|
|
|
} |
|
|
|
|
)); |
|
|
|
|
let direct_handler = room.connect_is_direct_notify(clone!( |
|
|
|
|
#[weak(rename_to = imp)] |
|
|
|
|
self, |
|
|
|
|
move |_| { |
|
|
|
|
imp.update_direct_icon(); |
|
|
|
|
} |
|
|
|
|
)); |
|
|
|
|
let name_handler = room.connect_display_name_notify(clone!( |
|
|
|
|
#[weak(rename_to = imp)] |
|
|
|
|
self, |
|
|
|
|
@ -141,7 +131,6 @@ mod imp {
|
|
|
|
|
room, |
|
|
|
|
vec![ |
|
|
|
|
highlight_handler, |
|
|
|
|
direct_handler, |
|
|
|
|
name_handler, |
|
|
|
|
notifications_count_handler, |
|
|
|
|
category_handler, |
|
|
|
|
@ -153,7 +142,6 @@ mod imp {
|
|
|
|
|
|
|
|
|
|
self.update_display_name(); |
|
|
|
|
self.update_highlight(); |
|
|
|
|
self.update_direct_icon(); |
|
|
|
|
self.obj().notify_room(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -244,26 +232,6 @@ mod imp {
|
|
|
|
|
row.remove_css_class("drag"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Update the icon showing whether a room is direct or not.
|
|
|
|
|
fn update_direct_icon(&self) { |
|
|
|
|
let is_direct = self.room.obj().is_some_and(|room| room.is_direct()); |
|
|
|
|
|
|
|
|
|
if is_direct { |
|
|
|
|
if self.direct_icon.borrow().is_none() { |
|
|
|
|
let icon = gtk::Image::builder() |
|
|
|
|
.icon_name("person-symbolic") |
|
|
|
|
.icon_size(gtk::IconSize::Normal) |
|
|
|
|
.css_classes(["dimmed"]) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
self.display_name_box.prepend(&icon); |
|
|
|
|
self.direct_icon.replace(Some(icon)); |
|
|
|
|
} |
|
|
|
|
} else if let Some(icon) = self.direct_icon.take() { |
|
|
|
|
self.display_name_box.remove(&icon); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Update the accessibility label of this row.
|
|
|
|
|
fn update_accessibility_label(&self) { |
|
|
|
|
let Some(parent) = self.obj().parent() else { |
|
|
|
|
@ -278,16 +246,28 @@ mod imp {
|
|
|
|
|
return String::new(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let name = if room.is_direct() { |
|
|
|
|
gettext_f( |
|
|
|
|
let name = match (room.is_video_room(), room.is_direct()) { |
|
|
|
|
(true, true) => gettext_f( |
|
|
|
|
// Translators: Do NOT translate the content between '{' and '}', this is a
|
|
|
|
|
// variable name. Presented to screen readers when a
|
|
|
|
|
// room is a direct chat with another user.
|
|
|
|
|
"Video chat with {name}", |
|
|
|
|
&[("name", &room.display_name())], |
|
|
|
|
), |
|
|
|
|
(false, true) => gettext_f( |
|
|
|
|
// Translators: Do NOT translate the content between '{' and '}', this is a
|
|
|
|
|
// variable name. Presented to screen readers when a
|
|
|
|
|
// room is a direct chat with another user.
|
|
|
|
|
"Direct chat with {name}", |
|
|
|
|
&[("name", &room.display_name())], |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
room.display_name() |
|
|
|
|
), |
|
|
|
|
(true, false) => gettext_f( |
|
|
|
|
// Translators: Do NOT translate the content between '{' and '}', this is a
|
|
|
|
|
// variable name.
|
|
|
|
|
"Video room called {room}", |
|
|
|
|
&[("room", &room.display_name())], |
|
|
|
|
), |
|
|
|
|
(false, false) => room.display_name(), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if room.notification_count() > 0 { |
|
|
|
|
|