aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/ui/account_settings_entry.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-14 14:55:59 +0100
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commit7e7dcedaf31ee35499875491c9f569c575d28435 (patch)
tree0c5fee2b28baf320775fbc92b3c252e97d9d054f /plugins/omemo/src/ui/account_settings_entry.vala
parentf25bfb00969a7e09996da2d5500e6718f4cc0148 (diff)
downloaddino-7e7dcedaf31ee35499875491c9f569c575d28435.tar.gz
dino-7e7dcedaf31ee35499875491c9f569c575d28435.zip
Port from GTK3 to GTK4
Diffstat (limited to 'plugins/omemo/src/ui/account_settings_entry.vala')
-rw-r--r--plugins/omemo/src/ui/account_settings_entry.vala54
1 files changed, 43 insertions, 11 deletions
diff --git a/plugins/omemo/src/ui/account_settings_entry.vala b/plugins/omemo/src/ui/account_settings_entry.vala
index 3866febe..8736260b 100644
--- a/plugins/omemo/src/ui/account_settings_entry.vala
+++ b/plugins/omemo/src/ui/account_settings_entry.vala
@@ -1,26 +1,58 @@
+using Dino.Entities;
+using Gtk;
+
namespace Dino.Plugins.Omemo {
public class AccountSettingsEntry : Plugins.AccountSettingsEntry {
private Plugin plugin;
+ private Account account;
+
+ private Box box = new Box(Orientation.HORIZONTAL, 0);
+ private Label fingerprint = new Label("...") { xalign=0 };
+ private Button btn = new Button.from_icon_name("view-list-symbolic") { has_frame=false, valign=Align.CENTER, visible=false };
+
+ public override string id { get { return "omemo_identity_key"; }}
+
+ public override string name { get { return "OMEMO"; }}
public AccountSettingsEntry(Plugin plugin) {
this.plugin = plugin;
- }
- public override string id { get {
- return "omemo_identity_key";
- }}
+ Border border = new Button().get_style_context().get_padding();
+ fingerprint.margin_top = border.top + 1;
+ fingerprint.margin_start = border.left + 1;
+ fingerprint.visible = true;
+ box.append(fingerprint);
- public override string name { get {
- return "OMEMO";
- }}
+ btn.clicked.connect(() => {
+ activated();
+ ContactDetailsDialog dialog = new ContactDetailsDialog(plugin, account, account.bare_jid);
+ dialog.set_transient_for((Window) box.get_root());
+ dialog.present();
+ });
+ // TODO expand=false?
+ box.append(btn);
+ }
+
+ public override Object? get_widget(WidgetType type) {
+ if (type != WidgetType.GTK4) return null;
+ return box;
+ }
- public override Plugins.AccountSettingsWidget? get_widget(WidgetType type) {
- if (type == WidgetType.GTK) {
- return new AccountSettingWidget(plugin);
+ public override void set_account(Account account) {
+ this.account = account;
+ btn.visible = false;
+ Qlite.Row? row = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id).inner;
+ if (row == null) {
+ fingerprint.set_markup("%s\n<span font='8'>%s</span>".printf(_("Own fingerprint"), _("Will be generated on first connection")));
+ } else {
+ string res = fingerprint_markup(fingerprint_from_base64(((!)row)[plugin.db.identity.identity_key_public_base64]));
+ fingerprint.set_markup("%s\n<span font_family='monospace' font='8'>%s</span>".printf(_("Own fingerprint"), res));
+ btn.visible = true;
}
- return null;
}
+
+ public override void deactivate() { }
}
} \ No newline at end of file