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



commit b103022041050694dacc4af1c7067422c12fd48f
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 8305539..f94cdd5 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]