diff options
| author | fiaxh <git@lightrise.org> | 2025-10-05 13:35:41 +0200 |
|---|---|---|
| committer | fiaxh <git@lightrise.org> | 2025-10-05 17:59:08 +0200 |
| commit | e14c7d933bfa0bdd97781857b9341854232058a2 (patch) | |
| tree | e302c07398dad3196a87a99843d9383ef116cb25 /main/src | |
| parent | 6d8ccb414529c017ef1b8a52499b7bbdb6432adb (diff) | |
Adjust to Adw 1.4: Use specialized ActionRows
Diffstat (limited to 'main/src')
5 files changed, 12 insertions, 27 deletions
diff --git a/main/src/ui/util/preference_group.vala b/main/src/ui/util/preference_group.vala index 6056f2c8..efb5253a 100644 --- a/main/src/ui/util/preference_group.vala +++ b/main/src/ui/util/preference_group.vala @@ -61,9 +61,7 @@ namespace Dino.Ui.Util { var view = new Adw.ActionRow() { title = row_text.title, subtitle = row_text.text, -#if Adw_1_3 - subtitle_selectable = true, -#endif + subtitle_selectable = true }; view.add_css_class("property"); @@ -88,17 +86,9 @@ namespace Dino.Ui.Util { foreach (string text in combobox_view_model.items) { string_list.append(text); } -#if Adw_1_4 var view = new Adw.ComboRow() { title = combobox_view_model.title }; view.model = string_list; combobox_view_model.bind_property("active-item", view, "selected", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); -#else - var view = new Adw.ActionRow() { title = combobox_view_model.title }; - var drop_down = new DropDown(string_list, null) { valign = Align.CENTER }; - combobox_view_model.bind_property("active-item", drop_down, "selected", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - view.activatable_widget = drop_down; - view.add_suffix(drop_down); -#endif return view; } diff --git a/main/src/windows/conversation_details.vala b/main/src/windows/conversation_details.vala index f6f420d2..bce9c423 100644 --- a/main/src/windows/conversation_details.vala +++ b/main/src/windows/conversation_details.vala @@ -78,10 +78,9 @@ namespace Dino.Ui.ConversationDetails { } block_button.menu_model = block_menu_model; -#if Adw_1_4 // TODO: replace with putting buttons in new line on small screens notification_button_menu_content.can_shrink = true; -#endif + update_blocked_button(); } diff --git a/main/src/windows/preferences_window/account_preferences_subpage.vala b/main/src/windows/preferences_window/account_preferences_subpage.vala index 1a7d5696..92fffa76 100644 --- a/main/src/windows/preferences_window/account_preferences_subpage.vala +++ b/main/src/windows/preferences_window/account_preferences_subpage.vala @@ -31,13 +31,11 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { private ulong alias_entry_changed = 0; construct { -#if Adw_1_4 headerbar.show_title = false; -#endif button_container.layout_manager = new NaturalDirectionBoxLayout((BoxLayout)button_container.layout_manager); back_button.clicked.connect(() => { var window = (Adw.PreferencesWindow) this.get_root(); - window.close_subpage(); + window.pop_subpage(); }); edit_avatar_button.clicked.connect(() => { show_select_avatar(); @@ -173,8 +171,7 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { model.remove_account(account); // Close the account subpage var window = (Adw.PreferencesWindow) this.get_root(); - window.close_subpage(); -// window.pop_subpage(); + window.pop_subpage(); } dialog.close(); }); diff --git a/main/src/windows/preferences_window/general_preferences_page.vala b/main/src/windows/preferences_window/general_preferences_page.vala index 6f8dd771..1e81a1b7 100644 --- a/main/src/windows/preferences_window/general_preferences_page.vala +++ b/main/src/windows/preferences_window/general_preferences_page.vala @@ -9,10 +9,10 @@ public class Dino.Ui.ViewModel.GeneralPreferencesPage : Object { [GtkTemplate (ui = "/im/dino/Dino/preferences_window/general_preferences_page.ui")] public class Dino.Ui.GeneralPreferencesPage : Adw.PreferencesPage { - [GtkChild] private unowned Switch typing_switch; - [GtkChild] private unowned Switch marker_switch; - [GtkChild] private unowned Switch notification_switch; - [GtkChild] private unowned Switch emoji_switch; + [GtkChild] private unowned Adw.SwitchRow typing_row; + [GtkChild] private unowned Adw.SwitchRow marker_row; + [GtkChild] private unowned Adw.SwitchRow notification_row; + [GtkChild] private unowned Adw.SwitchRow emoji_row; public ViewModel.GeneralPreferencesPage model { get; set; default = new ViewModel.GeneralPreferencesPage(); } private Binding[] model_bindings = new Binding[0]; @@ -27,10 +27,10 @@ public class Dino.Ui.GeneralPreferencesPage : Adw.PreferencesPage { } if (model != null) { model_bindings = new Binding[] { - model.bind_property("send-typing", typing_switch, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), - model.bind_property("send-marker", marker_switch, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), - model.bind_property("notifications", notification_switch, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), - model.bind_property("convert-emojis", emoji_switch, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL) + model.bind_property("send-typing", typing_row, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), + model.bind_property("send-marker", marker_row, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), + model.bind_property("notifications", notification_row, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL), + model.bind_property("convert-emojis", emoji_row, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL) }; } else { model_bindings = new Binding[0]; diff --git a/main/src/windows/preferences_window/preferences_window.vala b/main/src/windows/preferences_window/preferences_window.vala index 662a6924..cee4e34e 100644 --- a/main/src/windows/preferences_window/preferences_window.vala +++ b/main/src/windows/preferences_window/preferences_window.vala @@ -15,7 +15,6 @@ public class Dino.Ui.PreferencesWindow : Adw.PreferencesWindow { [GtkChild] public unowned ViewModel.PreferencesWindow model { get; } construct { - this.can_navigate_back = true; // remove once we require Adw > 1.4 this.bind_property("model", accounts_page, "model", BindingFlags.SYNC_CREATE); this.bind_property("model", account_page, "model", BindingFlags.SYNC_CREATE); this.bind_property("model", encryption_page, "model", BindingFlags.SYNC_CREATE); |
