[gnome-software/gnome-3-20] Show the correct button text when installing firmware



commit 043ef3b49f87197ccbc26f61366c3bbae8993f92
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 16 09:48:32 2016 +0000

    Show the correct button text when installing firmware

 src/gs-shell-details.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index ead168b..727d480 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -161,6 +161,7 @@ gs_shell_details_switch_to (GsPage *page, gboolean scroll_up)
        GsShellDetails *self = GS_SHELL_DETAILS (page);
        AsAppState state;
        GtkWidget *widget;
+       GtkStyleContext *sc;
        GtkAdjustment *adj;
 
        if (gs_shell_get_mode (self->shell) != GS_SHELL_MODE_DETAILS) {
@@ -214,9 +215,24 @@ gs_shell_details_switch_to (GsPage *page, gboolean scroll_up)
        case AS_APP_STATE_INSTALLED:
        case AS_APP_STATE_REMOVING:
        case AS_APP_STATE_UPDATABLE:
-       case AS_APP_STATE_UPDATABLE_LIVE:
                gtk_widget_set_visible (self->button_install, FALSE);
                break;
+       case AS_APP_STATE_UPDATABLE_LIVE:
+               gtk_widget_set_visible (self->button_install, TRUE);
+               gtk_widget_set_sensitive (self->button_install, TRUE);
+               sc = gtk_widget_get_style_context (self->button_install);
+               if (gs_app_get_kind (self->app) == AS_APP_KIND_FIRMWARE) {
+                       /* TRANSLATORS: button text in the header when firmware
+                        * can be live-installed */
+                       gtk_button_set_label (GTK_BUTTON (self->button_install), _("_Install"));
+                       gtk_style_context_add_class (sc, "suggested-action");
+               } else {
+                       /* TRANSLATORS: button text in the header when an application
+                        * can be live-updated */
+                       gtk_button_set_label (GTK_BUTTON (self->button_install), _("_Update"));
+                       gtk_style_context_remove_class (sc, "suggested-action");
+               }
+               break;
        case AS_APP_STATE_UNAVAILABLE:
                if (gs_app_get_url (self->app, AS_URL_KIND_MISSING) != NULL) {
                        gtk_widget_set_visible (self->button_install, FALSE);


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