From e14c7d933bfa0bdd97781857b9341854232058a2 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 5 Oct 2025 13:35:41 +0200 Subject: Adjust to Adw 1.4: Use specialized ActionRows --- plugins/omemo/data/encryption_preferences_entry.ui | 18 ++---------------- plugins/omemo/src/ui/encryption_preferences_entry.vala | 16 +++++++--------- plugins/openpgp/src/contact_details_provider.vala | 4 +--- plugins/openpgp/src/encryption_preferences_entry.vala | 8 -------- 4 files changed, 10 insertions(+), 36 deletions(-) (limited to 'plugins') diff --git a/plugins/omemo/data/encryption_preferences_entry.ui b/plugins/omemo/data/encryption_preferences_entry.ui index 6987c202..1aa1a541 100644 --- a/plugins/omemo/data/encryption_preferences_entry.ui +++ b/plugins/omemo/data/encryption_preferences_entry.ui @@ -12,24 +12,10 @@ - - - - center - - - + - - - automatically_accept_new_switch - - - center - - - + diff --git a/plugins/omemo/src/ui/encryption_preferences_entry.vala b/plugins/omemo/src/ui/encryption_preferences_entry.vala index 42b5d0aa..b620b320 100644 --- a/plugins/omemo/src/ui/encryption_preferences_entry.vala +++ b/plugins/omemo/src/ui/encryption_preferences_entry.vala @@ -36,10 +36,8 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { private Store store; private Set displayed_ids = new HashSet(); - [GtkChild] private unowned Adw.ActionRow automatically_accept_new_row; - [GtkChild] private Switch automatically_accept_new_switch; - [GtkChild] private unowned Adw.ActionRow encrypt_by_default_row; - [GtkChild] private Switch encrypt_by_default_switch; + [GtkChild] private unowned Adw.SwitchRow automatically_accept_new_row; + [GtkChild] private unowned Adw.SwitchRow encrypt_by_default_row; [GtkChild] private unowned Label new_keys_label; [GtkChild] private unowned Adw.PreferencesGroup keys_preferences_group; @@ -71,12 +69,12 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { return; } - automatically_accept_new_switch.set_active(plugin.db.trust.get_blind_trust(identity_id, jid.bare_jid.to_string(), true)); - automatically_accept_new_switch.state_set.connect(on_auto_accept_toggled); + automatically_accept_new_row.active = plugin.db.trust.get_blind_trust(identity_id, jid.bare_jid.to_string(), true); + automatically_accept_new_row.notify["active"].connect((obj, _) => { on_auto_accept_toggled(((Adw.SwitchRow) obj).active); }); encrypt_by_default_row.visible = account.bare_jid.equals_bare(jid); - encrypt_by_default_switch.set_active(plugin.app.settings.get_default_encryption(account) != Encryption.NONE); - encrypt_by_default_switch.state_set.connect(on_omemo_by_default_toggled); + encrypt_by_default_row.active = plugin.app.settings.get_default_encryption(account) != Encryption.NONE; + encrypt_by_default_row.notify["active"].connect((obj, _) => { on_omemo_by_default_toggled(((Adw.SwitchRow) obj).active); }); Dino.Application? app = Application.get_default() as Dino.Application; if (app != null) { @@ -269,7 +267,7 @@ public class OmemoPreferencesWidget : Adw.PreferencesGroup { case TrustLevel.VERIFIED: plugin.trust_manager.set_device_trust(account, jid, device[plugin.db.identity_meta.device_id], TrustLevel.VERIFIED); plugin.trust_manager.set_blind_trust(account, jid, false); - automatically_accept_new_switch.set_active(false); + automatically_accept_new_row.active = false; break; } } diff --git a/plugins/openpgp/src/contact_details_provider.vala b/plugins/openpgp/src/contact_details_provider.vala index 3b727121..353c0b85 100644 --- a/plugins/openpgp/src/contact_details_provider.vala +++ b/plugins/openpgp/src/contact_details_provider.vala @@ -39,9 +39,7 @@ public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object { var view = new Adw.ActionRow() { title = _("Fingerprint"), subtitle = str, -#if Adw_1_3 - subtitle_selectable = true, -#endif + subtitle_selectable = true }; preferences_group.add(view); diff --git a/plugins/openpgp/src/encryption_preferences_entry.vala b/plugins/openpgp/src/encryption_preferences_entry.vala index 26b982b8..28b253fc 100644 --- a/plugins/openpgp/src/encryption_preferences_entry.vala +++ b/plugins/openpgp/src/encryption_preferences_entry.vala @@ -38,17 +38,9 @@ namespace Dino.Plugins.OpenPgp { } StringList string_list = new StringList(null); -#if Adw_1_4 var drop_down = new Adw.ComboRow() { title = _("Announce key") }; drop_down.model = string_list; preferences_group.add(drop_down); -#else - var view = new Adw.ActionRow() { title = "Announce key" }; - var drop_down = new DropDown(string_list, null) { valign = Align.CENTER }; - view.activatable_widget = drop_down; - view.add_suffix(drop_down); - preferences_group.add(view); -#endif string_list.append(_("Disabled")); for (int i = 0; i < keys.size; i++) { -- cgit v1.3