[gnome-software/gnome-42: 1/2] gs-app-row: Apply workaround for gtk4 bug only for 4.6.3 and older versions




commit 8db34f84da20f883abfe6b2a6dc6fa3a21e3adb0
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 ec007d7d1..d0c742db6 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -924,6 +924,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 d7a2fc93b..93a350515 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]