[gnome-software/gnome-40: 1/2] gs-description-box: Reset GtkLabel properties before checking line count
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-40: 1/2] gs-description-box: Reset GtkLabel properties before checking line count
- Date: Tue, 13 Apr 2021 13:45:22 +0000 (UTC)
commit a16060c1866cd7dbe2ca8e224d9d5b4ffee88d1e
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 13 12:56:45 2021 +0200
gs-description-box: Reset GtkLabel properties before checking line count
The PangoLayout can return incorrect line numbers when it has set negative
height with a limit to how many lines can be shown, thus when setting original
text also set the limiting properties to their defaults, to avoid get proper
line count.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1199
src/gs-description-box.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-description-box.c b/src/gs-description-box.c
index 70085e80c..77e2d7498 100644
--- a/src/gs-description-box.c
+++ b/src/gs-description-box.c
@@ -64,6 +64,8 @@ gs_description_box_update_content (GsDescriptionBox *box)
gtk_button_set_label (box->button, box->is_collapsed ? _("_Read More") : _("_Read Less"));
gtk_label_set_text (box->label, box->text);
+ gtk_label_set_lines (box->label, -1);
+ gtk_label_set_ellipsize (box->label, PANGO_ELLIPSIZE_NONE);
layout = gtk_label_get_layout (box->label);
n_lines = pango_layout_get_line_count (layout);
@@ -91,9 +93,6 @@ gs_description_box_update_content (GsDescriptionBox *box)
gtk_label_set_text (box->label, str->str);
g_string_free (str, TRUE);
- } else {
- gtk_label_set_lines (box->label, -1);
- gtk_label_set_ellipsize (box->label, PANGO_ELLIPSIZE_NONE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]