From 3246d0793d6fa77a16160f3466d11a17296f4622 Mon Sep 17 00:00:00 2001 From: italo-capasso Date: Tue, 17 Dec 2024 09:46:59 -0500 Subject: [PATCH] Put the release notes description label inside a Gtk.Grid This is the same issue that we had for issues, but now for the description label itself. It seems that in a Gtk.Box with wrapped labels will not do its height correctly, if there are grids abound. Putting the label inside a Gtk.Grid will make it also respect the natural height and will fix another set of problems found in other description labels. --- src/Widgets/ReleaseRow.vala | 41 ++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/Widgets/ReleaseRow.vala b/src/Widgets/ReleaseRow.vala index 9d9b4b029..8155ecc85 100644 --- a/src/Widgets/ReleaseRow.vala +++ b/src/Widgets/ReleaseRow.vala @@ -29,8 +29,17 @@ public class AppCenter.Widgets.ReleaseRow : Gtk.Box { } construct { - var header_icon = new Gtk.Image.from_icon_name ("tag-symbolic"); + orientation = Gtk.Orientation.VERTICAL; + spacing = 6; + margin_bottom = 6; + + create_header (); + create_description (); + create_issues (); + } + private void create_header () { + var header_icon = new Gtk.Image.from_icon_name ("tag-symbolic"); var header_label = new Gtk.Label (format_version (release.get_version ())) { use_markup = true }; @@ -42,32 +51,40 @@ public class AppCenter.Widgets.ReleaseRow : Gtk.Box { }; date_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + var header_grid = new Gtk.Grid () { + column_spacing = 6, + row_spacing = 6, + margin_bottom = 6 + }; + header_grid.attach (header_icon, 0, 0); + header_grid.attach (header_label, 1, 0); + header_grid.attach (date_label, 2, 0); + + append (header_grid); + } + + private void create_description () { var description_label = new Gtk.Label (format_release_description (release.get_description ())) { selectable = true, use_markup = true, max_width_chars = 55, wrap = true, - xalign = 0 + xalign = 0, }; description_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); - var grid = new Gtk.Grid () { + var description_grid = new Gtk.Grid () { column_spacing = 6, row_spacing = 6, margin_bottom = 6 }; - grid.attach (header_icon, 0, 0); - grid.attach (header_label, 1, 0); - grid.attach (date_label, 2, 0); - grid.attach (description_label, 0, 1, 3); + description_grid.attach (description_label, 0, 0); - orientation = Gtk.Orientation.VERTICAL; - spacing = 6; - - append (grid); + append (description_grid); + } + private void create_issues () { var issues = release.get_issues (); - if (issues.length > 0) { var issue_header = new Gtk.Label (_("Fixed Issues")) { halign = Gtk.Align.START,