[gnome-software/wip/iainl/ubuntu-xenial] Set OS update app to AS_APP_STATE_UPDATABLE_LIVE when appropriate



commit 47255ae40e762648dc3855e962045c9638cd5bfc
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 dbdb04b..57f16cb 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1818,6 +1818,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 78d0e45..3425830 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -681,7 +681,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]