From 0e1004c31d5f8f61a9b917e3eb9d6985411ba3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 3 Nov 2026 09:21:48 -0800 Subject: [PATCH 1/3] SettingsSidebarRow: use Granite.HeaderLabel --- data/styles/SettingsSidebar.scss | 10 +---- lib/SettingsSidebarRow.vala | 65 +++++++++----------------------- 2 files changed, 19 insertions(+), 56 deletions(-) diff --git a/data/styles/SettingsSidebar.scss b/data/styles/SettingsSidebar.scss index 9bd54400..e7b358a2 100644 --- a/data/styles/SettingsSidebar.scss +++ b/data/styles/SettingsSidebar.scss @@ -15,15 +15,7 @@ settingssidebar { overlay { // IconSize.LARGE + padding - min-width: calc(32px + #{rem(6px)}); - } - - overlay:dir(ltr) { - margin-right: rem(6px); - } - - overlay:dir(rtl) { - margin-left: rem(6px); + min-width: calc(32px + 0.5rem); } } } diff --git a/lib/SettingsSidebarRow.vala b/lib/SettingsSidebarRow.vala index 2fae5fba..9015a241 100644 --- a/lib/SettingsSidebarRow.vala +++ b/lib/SettingsSidebarRow.vala @@ -26,36 +26,15 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { } } - public string? header { get; set; } - public unowned SettingsPage page { get; construct; } public Icon icon { get; set; } - - public string status { - set { - status_label.label = value; - status_label.visible = true; - update_property (Gtk.AccessibleProperty.DESCRIPTION, value, -1); - } - } - - public string title { - get { - return _title; - } - set { - _title = value; - title_label.label = value; - update_property (Gtk.AccessibleProperty.LABEL, value, -1); - } - } + public string? header { get; set; } + public string? status { get; set; } + public string title { get; set; } private Gtk.Widget display_widget; private Gtk.Image status_icon; - private Gtk.Label status_label; - private Gtk.Label title_label; - private string _title; public SettingsSidebarRow (SettingsPage page) { Object ( @@ -64,27 +43,19 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { } construct { - title_label = new Gtk.Label (page.title) { - ellipsize = Pango.EllipsizeMode.END, - vexpand = true, - xalign = 0 + var header_label = new Granite.HeaderLabel (page.title) { + ellipsize = END, + mnemonic_widget = this, + size = H3, + valign = CENTER, + vexpand = true }; - title_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); status_icon = new Gtk.Image () { halign = Gtk.Align.END, valign = Gtk.Align.END }; - status_label = new Gtk.Label (null) { - use_markup = true, - ellipsize = Pango.EllipsizeMode.END, - vexpand = true, - xalign = 0, - visible = false - }; - status_label.add_css_class (Granite.CssClass.SMALL); - if (!page.with_avatar) { display_widget = new Gtk.Image () { icon_size = LARGE @@ -100,23 +71,23 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { page.bind_property ("title", display_widget, "text", SYNC_CREATE); } - var overlay = new Gtk.Overlay (); - overlay.set_child (display_widget); + var overlay = new Gtk.Overlay () { + child = display_widget + }; overlay.add_overlay (status_icon); - var grid = new Gtk.Grid (); - grid.attach (overlay, 0, 0, 1, 2); - grid.attach (title_label, 1, 0); - grid.attach (status_label, 1, 1); + var box = new Granite.Box (HORIZONTAL, HALF); + box.append (overlay); + box.append (header_label); accessible_role = TAB; - child = grid; + child = box; header = page.header; page.bind_property ("icon", this, "icon", BindingFlags.DEFAULT); - page.bind_property ("status", this, "status", BindingFlags.DEFAULT); + page.bind_property ("status", header_label, "secondary-text", BindingFlags.DEFAULT); page.bind_property ("status-type", this, "status-type", BindingFlags.DEFAULT); - page.bind_property ("title", this, "title", BindingFlags.DEFAULT); + page.bind_property ("title", header_label, "label", BindingFlags.DEFAULT); if (page.status != null) { status = page.status; From aab778400d6afdd8a69e0d0a27b70fa0dd9b6b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 4 Nov 2026 07:50:15 -0800 Subject: [PATCH 2/3] Remove unused properties --- lib/SettingsSidebarRow.vala | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/SettingsSidebarRow.vala b/lib/SettingsSidebarRow.vala index 9015a241..2d3abc46 100644 --- a/lib/SettingsSidebarRow.vala +++ b/lib/SettingsSidebarRow.vala @@ -30,8 +30,6 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { public Icon icon { get; set; } public string? header { get; set; } - public string? status { get; set; } - public string title { get; set; } private Gtk.Widget display_widget; private Gtk.Image status_icon; @@ -89,10 +87,6 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { page.bind_property ("status-type", this, "status-type", BindingFlags.DEFAULT); page.bind_property ("title", header_label, "label", BindingFlags.DEFAULT); - if (page.status != null) { - status = page.status; - } - if (page.status_type != SettingsPage.StatusType.NONE) { status_type = page.status_type; } From 665ae1d2801a6a0614680a7587b515958aace314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 4 Nov 2026 07:52:48 -0800 Subject: [PATCH 3/3] Remove unused properties --- lib/SettingsSidebar.vala | 4 ++-- lib/SettingsSidebarRow.vala | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/SettingsSidebar.vala b/lib/SettingsSidebar.vala index b4c54b69..fe0726d1 100644 --- a/lib/SettingsSidebar.vala +++ b/lib/SettingsSidebar.vala @@ -105,10 +105,10 @@ public class Switchboard.SettingsSidebar : Gtk.Widget { }); listbox.set_header_func ((row, before) => { - var header = ((SettingsSidebarRow) row).header; + var header = ((SettingsSidebarRow) row).page.header; if (header != null) { if (before != null) { - var before_header = ((SettingsSidebarRow) before).header; + var before_header = ((SettingsSidebarRow) before).page.header; if (before_header != null && before_header == header) { return; } diff --git a/lib/SettingsSidebarRow.vala b/lib/SettingsSidebarRow.vala index 2d3abc46..2317f91b 100644 --- a/lib/SettingsSidebarRow.vala +++ b/lib/SettingsSidebarRow.vala @@ -28,9 +28,6 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { public unowned SettingsPage page { get; construct; } - public Icon icon { get; set; } - public string? header { get; set; } - private Gtk.Widget display_widget; private Gtk.Image status_icon; @@ -81,8 +78,6 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { accessible_role = TAB; child = box; - header = page.header; - page.bind_property ("icon", this, "icon", BindingFlags.DEFAULT); page.bind_property ("status", header_label, "secondary-text", BindingFlags.DEFAULT); page.bind_property ("status-type", this, "status-type", BindingFlags.DEFAULT); page.bind_property ("title", header_label, "label", BindingFlags.DEFAULT);