From a01056d17e62231d6e2c50d2327efbd01e295c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 8 Apr 2025 21:44:35 -0700 Subject: [PATCH 1/2] IconView: use Granite.HeaderLabel --- data/Application.css | 10 ++-------- src/IconView.vala | 31 ++++++++++--------------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/data/Application.css b/data/Application.css index 320ad23..0a1e6f9 100644 --- a/data/Application.css +++ b/data/Application.css @@ -27,14 +27,8 @@ margin-right: -4px; } -.header-area label.title-2 { - font-weight: 600; - font-size: 2rem; -} - -.header-area label:not(.title-2) { - font-size: 0.95rem; - opacity: 0.85; +.header-area .title-2 { + margin-top: 0; } .content-area { diff --git a/src/IconView.vala b/src/IconView.vala index 641db3c..f939eb5 100644 --- a/src/IconView.vala +++ b/src/IconView.vala @@ -24,20 +24,10 @@ public class IconView : Gtk.Box { valign = Gtk.Align.START }; - var title_label = new Gtk.Label (icon_name) { - selectable = true, - wrap = true, - xalign = 0, - valign = Gtk.Align.END - }; - title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); - - var description_label = new Gtk.Label (description) { - selectable = true, - wrap = true, - halign = Gtk.Align.START, - xalign = 0, - valign = Gtk.Align.START + var label = new Granite.HeaderLabel (icon_name) { + secondary_text = description, + size = H2, + valign = CENTER }; var window_controls = new Gtk.WindowControls (Gtk.PackType.END) { @@ -46,12 +36,11 @@ public class IconView : Gtk.Box { valign = Gtk.Align.START }; - var header_area = new Gtk.Grid (); + var header_area = new Granite.Box (HORIZONTAL, NONE); header_area.add_css_class ("header-area"); - header_area.attach (title_label, 1, 0); - header_area.attach (header_icon, 0, 0, 1, 2); - header_area.attach (description_label, 1, 1, 2); - header_area.attach (window_controls, 2, 0, 1, 2); + header_area.append (header_icon); + header_area.append (label); + header_area.append (window_controls); var header_handle = new Gtk.WindowHandle () { child = header_area @@ -174,8 +163,8 @@ public class IconView : Gtk.Box { }); bind_property ("icon-name", header_icon, "icon-name"); - bind_property ("icon-name", title_label, "label"); - bind_property ("description", description_label, "label"); + bind_property ("icon-name", label, "label"); + bind_property ("description", label, "secondary-text"); notify["icon-name"].connect (() => { fill_icon_row (icon_name, color_row); From e7adb564a3be5a16af754f129a626b1b5c81825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 8 Apr 2025 21:45:09 -0700 Subject: [PATCH 2/2] bump granite version requirement --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4c55190..3e9ae35 100644 --- a/meson.build +++ b/meson.build @@ -39,7 +39,7 @@ executable( dependencies: [ dependency('glib-2.0', version: '>= 2.78'), dependency('gobject-2.0'), - dependency('granite-7'), + dependency('granite-7', version: '>= 7.7.0'), dependency('gtk4'), dependency('gtksourceview-5') ],