[gnome-software/wip/william/update-all: 6/6] Set OS update app to AS_APP_STATE_UPDATABLE_LIVE when appropriate



commit 99823c4517dcdf95e28f5133bba0e7131c38f48a
Author: William Hua <william hua canonical com>
Date:   Thu Apr 7 16:46:52 2016 +0100

    Set OS update app to AS_APP_STATE_UPDATABLE_LIVE when appropriate

 src/gs-plugin-loader.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 614ae97..92686c3 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -662,6 +662,7 @@ static GList *
 gs_plugin_loader_add_os_update_item (GList *list)
 {
        gboolean has_os_update = FALSE;
+       gboolean updatable_live = TRUE;
        GList *l;
        GsApp *app_os;
        GsApp *app_tmp;
@@ -669,12 +670,12 @@ gs_plugin_loader_add_os_update_item (GList *list)
        g_autoptr(GdkPixbuf) pixbuf = NULL;
 
        /* do we have any packages left that are not apps? */
-       for (l = list; l != NULL; l = l->next) {
+       for (l = list; l != NULL && (!has_os_update || updatable_live); l = l->next) {
                app_tmp = GS_APP (l->data);
-               if (gs_plugin_loader_merge_into_os_update (app_tmp)) {
+               if (gs_plugin_loader_merge_into_os_update (app_tmp))
                        has_os_update = TRUE;
-                       break;
-               }
+               if (gs_app_get_state (app_tmp) == AS_APP_STATE_UPDATABLE)
+                       updatable_live = FALSE;
        }
        if (!has_os_update)
                return list;
@@ -682,7 +683,7 @@ gs_plugin_loader_add_os_update_item (GList *list)
        /* create new meta object */
        app_os = gs_app_new ("os-update.virtual");
        gs_app_set_kind (app_os, AS_APP_KIND_OS_UPDATE);
-       gs_app_set_state (app_os, AS_APP_STATE_UPDATABLE);
+       gs_app_set_state (app_os, updatable_live ? AS_APP_STATE_UPDATABLE_LIVE : AS_APP_STATE_UPDATABLE);
        gs_app_set_name (app_os,
                         GS_APP_QUALITY_NORMAL,
                         /* TRANSLATORS: this is a group of updates that are not


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