diff options
author | Samuel Hand <samuel.hand@openmailbox.org> | 2018-06-11 07:11:04 +0100 |
---|---|---|
committer | Samuel Hand <samuel.hand@openmailbox.org> | 2018-06-11 07:11:22 +0100 |
commit | 40c6835600cc6ebcb816f9aee4a6540ef8e362f0 (patch) | |
tree | a3bcbb33edeb469e1b7c17241a5cc40189287056 /plugins/omemo/src/contact_details_provider.vala | |
parent | 630df3a2ee3ac5086ab15ecbb4da88e0e2e9c82d (diff) | |
download | dino-40c6835600cc6ebcb816f9aee4a6540ef8e362f0.tar.gz dino-40c6835600cc6ebcb816f9aee4a6540ef8e362f0.zip |
Add trust management utilities to the omemo plugin
Diffstat (limited to 'plugins/omemo/src/contact_details_provider.vala')
-rw-r--r-- | plugins/omemo/src/contact_details_provider.vala | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/plugins/omemo/src/contact_details_provider.vala b/plugins/omemo/src/contact_details_provider.vala index 05b85d9f..2c6c4944 100644 --- a/plugins/omemo/src/contact_details_provider.vala +++ b/plugins/omemo/src/contact_details_provider.vala @@ -1,4 +1,5 @@ using Gtk; +using Gee; using Qlite; using Dino.Entities; @@ -15,20 +16,28 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object { public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) { if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK) { - string res = ""; + int i = 0; foreach (Row row in plugin.db.identity_meta.with_address(conversation.counterpart.to_string())) { if (row[plugin.db.identity_meta.identity_key_public_base64] != null) { - if (i != 0) { - res += "\n\n"; - } - res += fingerprint_markup(fingerprint_from_base64(row[plugin.db.identity_meta.identity_key_public_base64])); i++; } } + if (i > 0) { - Label label = new Label(res) { use_markup=true, justify=Justification.RIGHT, selectable=true, visible=true }; - contact_details.add(_("Encryption"), "OMEMO", n("%d OMEMO device", "%d OMEMO devices", i).printf(i), label); + Button btn = new Button(); + btn.image = new Image.from_icon_name("view-list-symbolic", IconSize.BUTTON); + btn.relief = ReliefStyle.NONE; + btn.visible = true; + btn.valign = Align.CENTER; + btn.clicked.connect(() => { + btn.activate(); + ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, conversation.account, conversation.counterpart); + dialog.set_transient_for((Window) btn.get_toplevel()); + dialog.present(); + }); + + contact_details.add(_("Encryption"), "OMEMO", n("%d OMEMO device", "%d OMEMO devices", i).printf(i), btn); } } } |