[gnome-software/wip/temp/ubuntu-xenial-rebased: 210/326] Show a 'Install All' button when all the updates can be installed live



commit 9b8bcc5b6597ab9553c05efaf7f34705257d3cda
Author: Richard Hughes <richard hughsie com>
Date:   Fri Apr 8 09:23:12 2016 +0100

    Show a 'Install All' button when all the updates can be installed live

 src/gs-shell-updates.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 9aaf391..79d73b2 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -482,9 +482,24 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
 
        /* get the results */
        list = gs_plugin_loader_get_updates_finish (plugin_loader, res, &error);
+       self->all_updates_are_live = TRUE;
        for (l = list; l != NULL; l = l->next) {
-               gs_update_list_add_app (GS_UPDATE_LIST (self->list_box_updates),
-                                       GS_APP (l->data));
+               GsApp *app = GS_APP (l->data);
+               if (gs_app_get_state (app) != AS_APP_STATE_UPDATABLE_LIVE)
+                       self->all_updates_are_live = FALSE;
+               gs_update_list_add_app (GS_UPDATE_LIST (self->list_box_updates), app);
+       }
+
+       /* change the button as to whether a reboot is required to
+        * apply all the updates */
+       if (self->all_updates_are_live) {
+               gtk_button_set_label (GTK_BUTTON (self->button_update_all),
+                                     /* TRANSLATORS: all updates will be installed */
+                                     _("_Install All"));
+       } else {
+               gtk_button_set_label (GTK_BUTTON (self->button_update_all),
+                                     /* TRANSLATORS: this is an offline update */
+                                     _("Restart & _Install"));
        }
 
        widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_updates_counter"));


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