[gnome-software/1420-app-page-show-more-button-label-glitches-while-resizing] gs-description-box: Update button label only when the text changes



commit 5d3a5e77b74a73611dbe6141e55f9374283b43e0
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 14 13:38:10 2021 +0200

    gs-description-box: Update button label only when the text changes
    
    This avoids flickering of the button text when resizing the window.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1420

 src/gs-description-box.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-description-box.c b/src/gs-description-box.c
index 2c84b7963..6e942452b 100644
--- a/src/gs-description-box.c
+++ b/src/gs-description-box.c
@@ -45,6 +45,7 @@ gs_description_box_update_content (GsDescriptionBox *box)
        GtkAllocation allocation;
        PangoLayout *layout;
        gint n_lines;
+       const gchar *text;
 
        if (!box->text || !*(box->text)) {
                gtk_widget_hide (GTK_WIDGET (box));
@@ -61,7 +62,9 @@ gs_description_box_update_content (GsDescriptionBox *box)
        box->last_width = allocation.width;
        box->last_height = allocation.height;
 
-       gtk_button_set_label (box->button, box->is_collapsed ? _("_Show More") : _("_Show Less"));
+       text = box->is_collapsed ? _("_Show More") : _("_Show Less");
+       if (g_strcmp0 (text, gtk_button_get_label (box->button)) != 0)
+               gtk_button_set_label (box->button, text);
 
        gtk_label_set_text (box->label, box->text);
        gtk_label_set_lines (box->label, -1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]