From 1016529c36011ec881820b61778821ae4caa230a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 28 Mar 2020 14:46:51 +0100 Subject: Visually mark OMEMO messages from a trusted device as trusted --- .../chat_state_populator.vala | 1 - .../conversation_item_skeleton.vala | 26 ++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'main/src/ui/conversation_content_view') diff --git a/main/src/ui/conversation_content_view/chat_state_populator.vala b/main/src/ui/conversation_content_view/chat_state_populator.vala index 54b41b7d..0438e014 100644 --- a/main/src/ui/conversation_content_view/chat_state_populator.vala +++ b/main/src/ui/conversation_content_view/chat_state_populator.vala @@ -62,7 +62,6 @@ class ChatStatePopulator : Plugins.ConversationItemPopulator, Plugins.Conversati } private class MetaChatStateItem : Plugins.MetaConversationItem { - public override bool dim { get; set; default=true; } public override DateTime sort_time { get; set; default=new DateTime.now_utc().add_years(10); } public override bool can_merge { get; set; default=false; } 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 589bcddd..b4cd766f 100644 --- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala +++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala @@ -88,8 +88,8 @@ public class ItemMetaDataHeader : Box { [GtkChild] public Label name_label; [GtkChild] public Label dot_label; [GtkChild] public Label time_label; - [GtkChild] public Image encryption_image; - [GtkChild] public Image received_image; + public Image received_image = new Image() { opacity=0.4 }; + public Image? encryption_image = null; public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON", 17, 12); @@ -106,9 +106,23 @@ public class ItemMetaDataHeader : Box { update_name_label(); name_label.style_updated.connect(update_name_label); - if (item.encryption != Encryption.NONE) { - encryption_image.visible = true; - encryption_image.set_from_icon_name("dino-changes-prevent-symbolic", ICON_SIZE_HEADER); + + Application app = GLib.Application.get_default() as Application; + + ContentMetaItem ci = item as ContentMetaItem; + if (ci != null) { + foreach(var e in app.plugin_registry.encryption_list_entries) { + if (e.encryption == item.encryption) { + Object? w = e.get_encryption_icon(conversation, ci.content_item); + if (w != null) { + this.add(w as Widget); + } else { + Image image = new Image.from_icon_name("dino-changes-prevent-symbolic", ICON_SIZE_HEADER) { opacity=0.4, visible = true }; + this.add(image); + } + break; + } + } } if (item.display_time != null) { update_time(); @@ -143,11 +157,9 @@ public class ItemMetaDataHeader : Box { received_image.visible = true; received_image.set_from_icon_name("dialog-warning-symbolic", ICON_SIZE_HEADER); Util.force_error_color(received_image); - Util.force_error_color(encryption_image); Util.force_error_color(time_label); string error_text = _("Unable to send message"); received_image.tooltip_text = error_text; - encryption_image.tooltip_text = error_text; time_label.tooltip_text = error_text; return; } else if (item.mark != Message.Marked.READ) { -- cgit v1.2.3-54-g00ecf