[gnome-software/wip/rancell/ubuntu-3-20-rebase: 47/52] Set OS update app to AS_APP_STATE_UPDATABLE_LIVE when appropriate



commit c911f56699a83379b79b7156fc5d872af04c0c66
Author: Richard Hughes <richard hughsie com>
Date:   Fri Apr 8 09:15:37 2016 +0100

    Set OS update app to AS_APP_STATE_UPDATABLE_LIVE when appropriate
    
    Based on a patch by William Hua, many thanks.

 src/gs-app.c           |    7 +++++++
 src/gs-plugin-loader.c |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 598a613..2910e53 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1851,6 +1851,13 @@ gs_app_add_related (GsApp *app, GsApp *app2)
 
        g_return_if_fail (GS_IS_APP (app));
 
+       /* if the app is updatable-live and any related app is not then
+        * degrade to the offline state */
+       if (app->state == AS_APP_STATE_UPDATABLE_LIVE &&
+           app2->state == AS_APP_STATE_UPDATABLE) {
+               app->state = app2->state;
+       }
+
        key = g_strdup_printf ("%s-%s",
                               gs_app_get_id (app2),
                               gs_app_get_source_default (app2));
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index d1586e6..873acf7 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -682,7 +682,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, AS_APP_STATE_UPDATABLE_LIVE);
        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]