diff options
author | fiaxh <git@lightrise.org> | 2024-12-24 16:02:13 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2025-01-12 19:35:58 +0100 |
commit | 5ee322cbd987d36497522b82b876659e1d19da43 (patch) | |
tree | c22d0bdbf92b30207b64ec74e925af4263ce91fc /plugins/omemo/src/ui/contact_details_provider.vala | |
parent | d78ec0562288fa4ed7d414d2269c00b7b8c2c588 (diff) | |
download | dino-5ee322cbd987d36497522b82b876659e1d19da43.tar.gz dino-5ee322cbd987d36497522b82b876659e1d19da43.zip |
Contact details dialog: Add encryption tab
Diffstat (limited to 'plugins/omemo/src/ui/contact_details_provider.vala')
-rw-r--r-- | plugins/omemo/src/ui/contact_details_provider.vala | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/plugins/omemo/src/ui/contact_details_provider.vala b/plugins/omemo/src/ui/contact_details_provider.vala index a97a40ad..7c733cd7 100644 --- a/plugins/omemo/src/ui/contact_details_provider.vala +++ b/plugins/omemo/src/ui/contact_details_provider.vala @@ -7,6 +7,7 @@ namespace Dino.Plugins.Omemo { public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object { public string id { get { return "omemo_info"; } } + public string tab { get { return "encryption"; } } private Plugin plugin; @@ -14,35 +15,14 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object { this.plugin = plugin; } - public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) { - if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK4) { - - int identity_id = plugin.db.identity.get_id(conversation.account.id); - if (identity_id < 0) return; - - int i = 0; - foreach (Row row in plugin.db.identity_meta.with_address(identity_id, conversation.counterpart.to_string())) { - if (row[plugin.db.identity_meta.identity_key_public_base64] != null) { - i++; - } - } - - if (i > 0) { - Button btn = new Button.from_icon_name("view-list-symbolic") { visible = true, valign = Align.CENTER, has_frame = false }; - btn.tooltip_text = _("OMEMO Key Management"); - btn.clicked.connect(() => { - btn.activate(); - ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, conversation.account, conversation.counterpart); - dialog.set_transient_for((Window) btn.get_root()); - dialog.response.connect((response_type) => { - plugin.device_notification_populator.should_hide(); - }); - dialog.present(); - }); - - contact_details.add(_("Encryption"), "OMEMO", n("%d OMEMO device", "%d OMEMO devices", i).printf(i), btn); - } - } + public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) { } + + public Object? get_widget(Conversation conversation) { + if (conversation.type_ != Conversation.Type.CHAT) return null; + + var widget = new OmemoPreferencesWidget(plugin); + widget.set_jid(conversation.account, conversation.counterpart); + return widget; } } |