[gnome-software/1199-ui-stutters-during-app-installation-keypress-events] gs-description-box: Reset GtkLabel properties before checking line count



commit 804dcabf6ccab43a4986d00b062196956668beb5
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]