[gnome-software/eos-updater-upstream: 1/11] gs-upgrade-banner: Change button/label text for reboot upgrades



commit a6a6229bbac531950a4ebc29aad932841cfb2159
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Mar 28 17:11:46 2019 +0000

    gs-upgrade-banner: Change button/label text for reboot upgrades
    
    For OSs which have parallel deployments (i.e. those based on OSTree),
    an upgrade is a reboot into a new deployment — no additional install
    steps are required on reboot.
    
    Change the upgrade banner button text to indicate that only a reboot is
    require. Chain this to the GS_APP_QUIRK_NEEDS_REBOOT quirk.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 src/gs-upgrade-banner.c  | 16 ++++++++++++++++
 src/gs-upgrade-banner.ui |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-upgrade-banner.c b/src/gs-upgrade-banner.c
index 0837a171..3933abbc 100644
--- a/src/gs-upgrade-banner.c
+++ b/src/gs-upgrade-banner.c
@@ -57,6 +57,22 @@ gs_upgrade_banner_refresh (GsUpgradeBanner *self)
        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));
 
+       /* Show the right button text. Distributions which are based on OSTree
+        * don’t need a post-reboot installation step. */
+       if (gs_app_has_quirk (priv->app, GS_APP_QUIRK_NEEDS_REBOOT)) {
+               gtk_button_set_label (GTK_BUTTON (priv->button_upgrades_install),
+                                     _("_Restart Now"));
+               gtk_label_set_text (GTK_LABEL (priv->label_upgrades_warning),
+                                   _("Updates will be applied when the "
+                                     "computer is restarted."));
+       } else {
+               gtk_button_set_label (GTK_BUTTON (priv->button_upgrades_install),
+                                     _("_Install"));
+               gtk_label_set_text (GTK_LABEL (priv->label_upgrades_warning),
+                                   _("It is recommended that you back up your "
+                                     "data and files before upgrading."));
+       }
+
        /* Refresh the title. Normally a distro upgrade state goes from
         *
         * AVAILABLE (available to download) to
diff --git a/src/gs-upgrade-banner.ui b/src/gs-upgrade-banner.ui
index b69c3bda..3e53a257 100644
--- a/src/gs-upgrade-banner.ui
+++ b/src/gs-upgrade-banner.ui
@@ -82,7 +82,7 @@
             <child>
               <object class="GtkLabel" id="label_upgrades_warning">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">It is recommended that you back up your data and 
files before upgrading.</property>
+                <property name="label"></property><!-- Set in code -->
                 <property name="justify">center</property>
                 <property name="wrap">True</property>
               </object>
@@ -119,7 +119,7 @@
             </child>
             <child>
               <object class="GtkButton" id="button_upgrades_install">
-                <property name="label" translatable="yes">_Install</property>
+                <property name="label">_Install</property><!-- Set in code -->
                 <property name="width_request">150</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>


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