From 1f5763b717296c6a449a8a8bc3ac29df8dc27032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Sat, 3 Feb 2024 01:20:47 -0800 Subject: [PATCH] Use Switchboard.SettingsPage (#99) --- .github/workflows/main.yml | 5 ++-- src/Widgets/AppSettingsView.vala | 41 +++++++------------------------- src/Widgets/SettingsOption.vala | 2 -- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2529fb8f..48fb4af0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,8 +9,7 @@ on: jobs: build: - - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false @@ -24,7 +23,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y meson libgranite-7-dev libgtk-4-dev libswitchboard-3-dev valac + apt install -y meson libadwaita-1-dev libgranite-7-dev libgtk-4-dev libswitchboard-3-dev valac - name: Build env: DESTDIR: out diff --git a/src/Widgets/AppSettingsView.vala b/src/Widgets/AppSettingsView.vala index 71861ca4..035eca84 100644 --- a/src/Widgets/AppSettingsView.vala +++ b/src/Widgets/AppSettingsView.vala @@ -17,32 +17,12 @@ * Boston, MA 02110-1301, USA. */ -public class Widgets.AppSettingsView : Gtk.Grid { - private Gtk.Image app_image; - private Gtk.Label app_label; - +public class Widgets.AppSettingsView : Switchboard.SettingsPage { private SettingsOption bubbles_option; private SettingsOption sound_option; private SettingsOption remember_option; construct { - app_image = new Gtk.Image () { - pixel_size = 48 - }; - - app_label = new Gtk.Label (null) { - use_markup = true, - halign = Gtk.Align.START, - hexpand = true - }; - app_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); - - var header = new Gtk.Grid () { - column_spacing = 12 - }; - header.attach (app_image, 0, 0); - header.attach (app_label, 1, 0); - bubbles_option = new SettingsOption ( "bubbles", _("Bubbles"), @@ -64,15 +44,12 @@ public class Widgets.AppSettingsView : Gtk.Grid { new Gtk.Switch () ); - margin_start = 12; - margin_end = 12; - margin_top = 12; - margin_bottom = 12; - row_spacing = 32; - attach (header, 0, 0); - attach (bubbles_option, 0, 1); - attach (sound_option, 0, 2); - attach (remember_option, 0, 3); + var box = new Gtk.Box (VERTICAL, 32); + box.append (bubbles_option); + box.append (sound_option); + box.append (remember_option); + + child = box; update_selected_app (); @@ -97,7 +74,7 @@ public class Widgets.AppSettingsView : Gtk.Grid { selected_app.settings.bind ("sounds", sound_option.widget, "state", GLib.SettingsBindFlags.DEFAULT); selected_app.settings.bind ("remember", remember_option.widget, "state", GLib.SettingsBindFlags.DEFAULT); - app_label.label = selected_app.app_info.get_display_name (); - app_image.gicon = selected_app.app_info.get_icon (); + title = selected_app.app_info.get_display_name (); + icon = selected_app.app_info.get_icon (); } } diff --git a/src/Widgets/SettingsOption.vala b/src/Widgets/SettingsOption.vala index 2d4aaaf9..936683ff 100644 --- a/src/Widgets/SettingsOption.vala +++ b/src/Widgets/SettingsOption.vala @@ -75,8 +75,6 @@ public class Widgets.SettingsOption : Gtk.Grid { column_spacing = 12; row_spacing = 6; - margin_start = 60; - margin_end = 30; attach (card, 0, 0, 1, 3); attach (title_label, 1, 0); attach (widget, 1, 1);