From f3cb87c6cab2170b42376422c462929a1a400608 Mon Sep 17 00:00:00 2001 From: Danielle Fore Date: Wed, 31 Jan 2024 13:41:54 -0800 Subject: [PATCH] Use Switchboard.SettingsPage --- src/Widgets/AppSettingsView.vala | 41 +++++++------------------------- src/Widgets/SettingsOption.vala | 2 -- 2 files changed, 9 insertions(+), 34 deletions(-) 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);