From 853dfa2d6f0d1300b096f0c6a12ca179208f5287 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 28 Mar 2020 19:55:22 +0100 Subject: [PATCH] Visually mark unencrypted messages if conversation is encrypted --- main/CMakeLists.txt | 1 + .../icons/dino-changes-allowed-symbolic.svg | 10 +++++++++ .../conversation_item_skeleton.vala | 21 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 main/data/icons/dino-changes-allowed-symbolic.svg diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 083e64c8..5f5b7831 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -13,6 +13,7 @@ find_packages(MAIN_PACKAGES REQUIRED ) set(RESOURCE_LIST + icons/dino-changes-allowed-symbolic.svg icons/dino-changes-prevent-symbolic.svg icons/dino-conversation-list-placeholder-arrow.svg icons/dino-double-tick-symbolic.svg diff --git a/main/data/icons/dino-changes-allowed-symbolic.svg b/main/data/icons/dino-changes-allowed-symbolic.svg new file mode 100644 index 00000000..46f4487c --- /dev/null +++ b/main/data/icons/dino-changes-allowed-symbolic.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala index b4cd766f..8c59dde7 100644 --- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala +++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala @@ -124,6 +124,13 @@ public class ItemMetaDataHeader : Box { } } } + if (item.encryption == Encryption.NONE) { + conversation.notify["encryption"].connect(update_unencrypted_icon); + update_unencrypted_icon(); + } + + this.add(received_image); + if (item.display_time != null) { update_time(); } @@ -132,6 +139,20 @@ public class ItemMetaDataHeader : Box { update_received_mark(); } + private void update_unencrypted_icon() { + if (conversation.encryption != Encryption.NONE) { + encryption_image = new Image() { opacity=0.4, visible = true }; + encryption_image.set_from_icon_name("dino-changes-allowed-symbolic", ICON_SIZE_HEADER); + encryption_image.tooltip_text = _("Unencrypted"); + this.add(encryption_image); + this.reorder_child(encryption_image, 3); + Util.force_error_color(encryption_image); + } else if (encryption_image != null) { + encryption_image.destroy(); + encryption_image = null; + } + } + private void update_time() { time_label.label = get_relative_time(item.display_time.to_local()).to_string();