[gnome-software/1525-os-upgrade-vertically-center-download-button: 2/2] gs-upgrade-banner: Hide download info label when not set




commit 242fb6487b4156f72fd7a86c471571958f14abf1
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 1 15:33:46 2021 +0100

    gs-upgrade-banner: Hide download info label when not set
    
    It uses vertical space even when being left empty, causing
    the Download button look vertically non-centered.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1525

 src/gs-upgrade-banner.c  | 4 ++++
 src/gs-upgrade-banner.ui | 3 +++
 2 files changed, 7 insertions(+)
---
diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c
index 902c4e745..2a87cc580 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -139,6 +139,7 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
                g_autofree gchar *link = NULL;
                link = g_markup_printf_escaped ("<a href=\"%s\">%s</a>", uri, _("Learn about the new 
version"));
                gtk_label_set_markup (GTK_LABEL (priv->label_download_info), link);
+               gtk_widget_show (priv->label_download_info);
        } else if (gs_app_get_size_download (priv->app) != GS_APP_SIZE_UNKNOWABLE &&
                   gs_app_get_size_download (priv->app) != 0) {
                g_autofree gchar *tmp = NULL;
@@ -147,6 +148,9 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
                /* Translators: the '%s' is replaced with the download size, forming text like "2 GB 
download" */
                str = g_strdup_printf ("%s download", tmp);
                gtk_label_set_text (GTK_LABEL (priv->label_download_info), str);
+               gtk_widget_show (priv->label_download_info);
+       } else {
+               gtk_widget_hide (priv->label_download_info);
        }
 
        /* do a fill bar for the current progress */
diff --git a/src/gs-upgrade-banner.ui b/src/gs-upgrade-banner.ui
index 4aff55962..b7910397c 100644
--- a/src/gs-upgrade-banner.ui
+++ b/src/gs-upgrade-banner.ui
@@ -78,6 +78,7 @@
                     <property name="use_underline">True</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
+                    <property name="vexpand">True</property>
                     <style>
                       <class name="circular"/>
                       <class name="suggested-action"/>
@@ -130,6 +131,8 @@
                       <object class="GtkLabel" id="label_upgrades_downloading">
                         <property name="label"></property> <!-- set in the code -->
                         <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <property name="vexpand">True</property>
                         <property name="justify">center</property>
                         <attributes>
                           <attribute name="scale" value="0.8"/>


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