From 2ba1fe874070fc372c1a522c5c5b97173fbe1459 Mon Sep 17 00:00:00 2001 From: frosty Date: Wed, 26 Aug 2026 15:01:29 -0400 Subject: feat: add tweaks page to preferences, as well as an option for avatar roundness --- .../preferences_window/preferences_dialog.vala | 3 ++- .../tweaks_preferences_page.vala | 27 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 main/src/windows/preferences_window/tweaks_preferences_page.vala (limited to 'main/src/windows') diff --git a/main/src/windows/preferences_window/preferences_dialog.vala b/main/src/windows/preferences_window/preferences_dialog.vala index 4baced96..a92575f0 100644 --- a/main/src/windows/preferences_window/preferences_dialog.vala +++ b/main/src/windows/preferences_window/preferences_dialog.vala @@ -10,6 +10,7 @@ public class Dino.Ui.PreferencesDialog : Adw.PreferencesDialog { [GtkChild] public unowned Dino.Ui.PreferencesWindowAccounts accounts_page; [GtkChild] public unowned Dino.Ui.PreferencesWindowEncryption encryption_page; [GtkChild] public unowned Dino.Ui.GeneralPreferencesPage general_page; + [GtkChild] public unowned Dino.Ui.TweaksPreferencesPage tweaks_page; [GtkChild] public unowned ViewModel.PreferencesDialog model { get; } @@ -24,4 +25,4 @@ public class Dino.Ui.PreferencesDialog : Adw.PreferencesDialog { this.push_subpage(account_page); }); } -} \ No newline at end of file +} diff --git a/main/src/windows/preferences_window/tweaks_preferences_page.vala b/main/src/windows/preferences_window/tweaks_preferences_page.vala new file mode 100644 index 00000000..6da43348 --- /dev/null +++ b/main/src/windows/preferences_window/tweaks_preferences_page.vala @@ -0,0 +1,27 @@ +using Gtk; + +public class Dino.Ui.ViewModel.TweaksPreferencesPage : Object { + public int avatar_roundness { get; set; } +} + +[GtkTemplate (ui = "/im/dino/Dino/preferences_window/tweaks_preferences_page.ui")] +public class Dino.Ui.TweaksPreferencesPage : Adw.PreferencesPage { + [GtkChild] private unowned Adw.SpinRow avatar_roundness_row; + + public ViewModel.TweaksPreferencesPage model { get; set; default = new ViewModel.TweaksPreferencesPage(); } + private Binding? avatar_roundness_binding; + + construct { + this.notify["model"].connect(on_model_changed); + } + + private void on_model_changed() { + if (avatar_roundness_binding != null) { + avatar_roundness_binding.unbind(); + avatar_roundness_binding = null; + } + if (model != null) { + avatar_roundness_binding = model.bind_property("avatar-roundness", avatar_roundness_row, "value", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + } + } +} -- cgit v1.3