[gnome-software/1646-workaround-gtk4-bug-gtk_widget_measure-error] gs-app-row: Apply workaround for gtk4 bug only for 4.6.3 and older versions



commit ef5d6a78a1e1ca881a69efa82b30e243bcc91e46
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 19 08:36:43 2022 +0200

    gs-app-row: Apply workaround for gtk4 bug only for 4.6.3 and older versions
    
    The gtk4 4.6.4 contains a fix, thus check in runtime which version
    gnome-software runs with and apply, or not, the workaround according
    to that.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1646

 src/gs-app-row.c  | 22 ++++++++++++++++++++++
 src/gs-app-row.ui | 15 +++++++--------
 2 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index e9ec818af..4b017e085 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -925,6 +925,28 @@ gs_app_row_init (GsAppRow *app_row)
 
        g_signal_connect (priv->button, "clicked",
                          G_CALLBACK (button_clicked), app_row);
+
+       /* A fix for this is included in 4.6.4, apply workaround, if not running with new-enough gtk. */
+       if (gtk_get_major_version () < 4 ||
+          (gtk_get_major_version () == 4 && gtk_get_minor_version () < 6) ||
+          (gtk_get_major_version () == 4 && gtk_get_minor_version () == 6 && gtk_get_micro_version () < 4)) {
+               g_object_set (G_OBJECT (priv->name_label),
+                             "wrap", FALSE,
+                             "lines", 1,
+                             NULL);
+               g_object_set (G_OBJECT (priv->description_label),
+                             "wrap", FALSE,
+                             "lines", 1,
+                             NULL);
+               g_object_set (G_OBJECT (priv->label_warning),
+                             "wrap", FALSE,
+                             "lines", 1,
+                             NULL);
+               g_object_set (G_OBJECT (priv->system_updates_label),
+                             "wrap", FALSE,
+                             "lines", 1,
+                             NULL);
+       }
 }
 
 void
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index e2ab24ce4..1fdc2ede1 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -30,11 +30,11 @@
             </style>
             <child>
               <object class="GtkLabel" id="name_label">
-                <property name="wrap">False</property>
+                <property name="wrap">True</property>
                 <property name="xalign">0.0</property>
                 <property name="yalign">0.5</property>
                 <property name="ellipsize">end</property>
-                <property name="lines">1</property>
+                <property name="lines">3</property>
                 <property name="wrap-mode">word-char</property>
                 <style>
                   <class name="title"/>
@@ -46,10 +46,10 @@
                 <property name="visible" bind-source="GsAppRow" bind-property="show-description" 
bind-flags="sync-create"/>
                 <property name="valign">start</property>
                 <property name="vexpand">True</property>
-                <property name="wrap">False</property>
+                <property name="wrap">True</property>
                 <property name="wrap-mode">word-char</property>
                 <property name="ellipsize">end</property>
-                <property name="lines">1</property>
+                <property name="lines">2</property>
                 <property name="xalign">0</property>
                 <style>
                   <class name="subtitle"/>
@@ -99,9 +99,8 @@
                 <property name="visible">False</property>
                 <property name="label">warning-text</property>
                 <property name="halign">start</property>
-                <property name="wrap">False</property>
+                <property name="wrap">True</property>
                 <property name="xalign">0</property>
-                <property name="lines">1</property>
                 <style>
                   <class name="title"/>
                   <class name="warning"/>
@@ -120,10 +119,10 @@
                     <property name="visible">False</property>
                     <property name="xalign">0.0</property>
                     <property name="yalign">0.5</property>
-                    <property name="wrap">False</property>
+                    <property name="wrap">True</property>
                     <property name="wrap-mode">word-char</property>
                     <property name="ellipsize">end</property>
-                    <property name="lines">1</property>
+                    <property name="lines">2</property>
                     <style>
                       <class name="subtitle"/>
                     </style>


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