diff --git a/data/resources/icons/scalable/status/padlock2-symbolic.svg b/data/resources/icons/scalable/status/padlock2-symbolic.svg
new file mode 100644
index 000000000..8403823ea
--- /dev/null
+++ b/data/resources/icons/scalable/status/padlock2-symbolic.svg
@@ -0,0 +1,2 @@
+
+
diff --git a/data/resources/resources.gresource.xml b/data/resources/resources.gresource.xml
index 2f0828c66..76b9cd67d 100644
--- a/data/resources/resources.gresource.xml
+++ b/data/resources/resources.gresource.xml
@@ -16,6 +16,7 @@
icons/scalable/status/message-read-symbolic.svg
icons/scalable/status/message-unread-left-symbolic.svg
icons/scalable/status/message-unread-right-symbolic.svg
+ icons/scalable/status/padlock2-symbolic.svg
images/pattern.svg
diff --git a/src/ui/session/content/chat_history.rs b/src/ui/session/content/chat_history.rs
index cae99edf9..137e3bcf2 100644
--- a/src/ui/session/content/chat_history.rs
+++ b/src/ui/session/content/chat_history.rs
@@ -29,6 +29,7 @@ mod imp {
pub(super) is_auto_scrolling: Cell,
pub(super) is_loading_messages: Cell,
pub(super) sticky: Cell,
+ pub(super) is_secret_chat: Cell,
#[template_child]
pub(super) window_title: TemplateChild,
#[template_child]
@@ -92,6 +93,9 @@ mod imp {
glib::ParamSpecBoolean::builder("sticky")
.read_only()
.build(),
+ glib::ParamSpecBoolean::builder("is-secret-chat")
+ .read_only()
+ .build(),
]
});
PROPERTIES.as_ref()
@@ -106,6 +110,7 @@ mod imp {
obj.set_chat(chat);
}
"sticky" => obj.set_sticky(value.get().unwrap()),
+ "is_secret_chat" => obj.set_is_secret_chat(value.get().unwrap()),
_ => unimplemented!(),
}
}
@@ -116,6 +121,7 @@ mod imp {
match pspec.name() {
"chat" => obj.chat().to_value(),
"sticky" => obj.sticky().to_value(),
+ "is-secret-chat" => obj.is_secret_chat().to_value(),
_ => unimplemented!(),
}
}
@@ -311,6 +317,15 @@ impl ChatHistory {
let imp = self.imp();
if let Some(chat) = chat {
+ match chat.chat_type() {
+ model::ChatType::Secret(_) => {
+ self.set_is_secret_chat(true);
+ }
+ _ => {
+ self.set_is_secret_chat(false);
+ }
+ }
+
self.action_set_enabled(
"chat-history.leave-chat",
match chat.chat_type() {
@@ -412,6 +427,19 @@ impl ChatHistory {
self.notify("sticky");
}
+ pub(crate) fn is_secret_chat(&self) -> bool {
+ self.imp().is_secret_chat.get()
+ }
+
+ fn set_is_secret_chat(&self, is_secret_chat: bool) {
+ if self.is_secret_chat() == is_secret_chat {
+ return;
+ }
+
+ self.imp().is_secret_chat.set(is_secret_chat);
+ self.notify("is-secret-chat");
+ }
+
fn scroll_down(&self) {
let imp = self.imp();
diff --git a/src/ui/session/content/chat_history.ui b/src/ui/session/content/chat_history.ui
index 34d78ac31..909d47750 100644
--- a/src/ui/session/content/chat_history.ui
+++ b/src/ui/session/content/chat_history.ui
@@ -9,7 +9,18 @@