Skip to content

Commit

Permalink
Put the release notes description label inside a Gtk.Grid
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
italo-capasso committed Dec 17, 2024
1 parent efb5ad2 commit 3246d07
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions src/Widgets/ReleaseRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -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,
Expand Down

0 comments on commit 3246d07

Please sign in to comment.