[gnome-software/gnome-3-20] trivial: Use the new bold style for distro upgrades



commit e2649079601621059a5dbe951fb5b437e8f748b1
Author: Richard Hughes <richard hughsie com>
Date:   Thu Apr 14 16:56:51 2016 +0100

    trivial: Use the new bold style for distro upgrades

 src/gs-upgrade-banner.c |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c
index 45a18db..6a460af 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -54,10 +54,17 @@ static void
 gs_upgrade_banner_refresh (GsUpgradeBanner *self)
 {
        GsUpgradeBannerPrivate *priv = gs_upgrade_banner_get_instance_private (self);
+       g_autofree gchar *name_bold = NULL;
+       g_autofree gchar *version_bold = NULL;
+       g_autofree gchar *str = NULL;
 
        if (priv->app == NULL)
                return;
 
+       /* embolden */
+       name_bold = g_strdup_printf ("<b>%s</b>", gs_app_get_name (priv->app));
+       version_bold = g_strdup_printf ("<b>%s</b>", gs_app_get_version (priv->app));
+
        /* Refresh the title. Normally a distro upgrade state goes from
         *
         * AVAILABLE (available to download) to
@@ -66,45 +73,36 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
         */
        switch (gs_app_get_state (priv->app)) {
        case AS_APP_STATE_AVAILABLE:
-       {
-               g_autofree gchar *str = NULL;
-
                /* TRANSLATORS: This is the text displayed when a distro
                 * upgrade is available. First %s is the distro name and the
                 * 2nd %s is the version, e.g. "Fedora 23 Now Available" */
                str = g_strdup_printf (_("%s %s Now Available"),
-                                      gs_app_get_name (priv->app),
-                                      gs_app_get_version (priv->app));
-               gtk_label_set_text (GTK_LABEL (priv->label_upgrades_title), str);
+                                      name_bold, version_bold);
+               gtk_label_set_markup (GTK_LABEL (priv->label_upgrades_title), str);
+               gtk_widget_set_visible (priv->label_upgrades_warning, FALSE);
+               gtk_widget_set_visible (priv->button_upgrades_cancel, FALSE);
                break;
-       }
        case AS_APP_STATE_INSTALLING:
-       {
-               g_autofree gchar *str = NULL;
-
                /* TRANSLATORS: This is the text displayed while downloading a
                 * distro upgrade. First %s is the distro name and the 2nd %s
                 * is the version, e.g. "Downloading Fedora 23" */
                str = g_strdup_printf (_("Downloading %s %s"),
-                                      gs_app_get_name (priv->app),
-                                      gs_app_get_version (priv->app));
-               gtk_label_set_text (GTK_LABEL (priv->label_upgrades_title), str);
+                                      name_bold, version_bold);
+               gtk_label_set_markup (GTK_LABEL (priv->label_upgrades_title), str);
+               gtk_widget_set_visible (priv->label_upgrades_warning, FALSE);
+               gtk_widget_set_visible (priv->button_upgrades_cancel, TRUE);
                break;
-       }
        case AS_APP_STATE_UPDATABLE:
-       {
-               g_autofree gchar *str = NULL;
-
                /* TRANSLATORS: This is the text displayed when a distro
                 * upgrade has been downloaded and is ready to be installed.
                 * First %s is the distro name and the 2nd %s is the version,
                 * e.g. "Fedora 23 Ready to be Installed" */
                str = g_strdup_printf (_("%s %s Ready to be Installed"),
-                                      gs_app_get_name (priv->app),
-                                      gs_app_get_version (priv->app));
-               gtk_label_set_text (GTK_LABEL (priv->label_upgrades_title), str);
+                                      name_bold, version_bold);
+               gtk_label_set_markup (GTK_LABEL (priv->label_upgrades_title), str);
+               gtk_widget_set_visible (priv->label_upgrades_warning, TRUE);
+               gtk_widget_set_visible (priv->button_upgrades_cancel, FALSE);
                break;
-       }
        default:
                g_critical ("Unexpected app state");
                break;


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