[gnome-software/gnome-3-20] Do not set all components from AppStream type DESKTOP



commit c09185fb75450757c03260bc505be5a99ff67479
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 29 18:13:33 2016 +0000

    Do not set all components from AppStream type DESKTOP

 src/gs-app.c                  |   19 ++++---------------
 src/plugins/gs-appstream.c    |   13 ++++++-------
 src/plugins/gs-plugin-fwupd.c |    2 +-
 3 files changed, 11 insertions(+), 23 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 1d3e30b..898020f 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -585,29 +585,18 @@ gs_app_set_kind (GsApp *app, AsAppKind kind)
        /* check the state change is allowed */
        switch (app->kind) {
        case AS_APP_KIND_UNKNOWN:
-               /* unknown can go into any state */
-               state_change_ok = TRUE;
-               break;
        case AS_APP_KIND_GENERIC:
-               /* package can become either normal or a system application */
-               if (kind == AS_APP_KIND_DESKTOP ||
-                   kind == AS_APP_KIND_SOURCE ||
-                   kind == AS_APP_KIND_UNKNOWN)
-                       state_change_ok = TRUE;
+               /* all others derive from generic */
+               state_change_ok = TRUE;
                break;
        case AS_APP_KIND_DESKTOP:
-               /* normal can only be promoted to system */
+               /* desktop has to be reset to override */
                if (kind == AS_APP_KIND_UNKNOWN)
                        state_change_ok = TRUE;
                break;
-       case AS_APP_KIND_OS_UPDATE:
-       case AS_APP_KIND_SOURCE:
+       default:
                /* this can never change state */
                break;
-       default:
-               g_warning ("kind %s unhandled",
-                          as_app_kind_to_string (app->kind));
-               g_assert_not_reached ();
        }
 
        /* this state change was unexpected */
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 19278be..6446ee8 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -359,7 +359,10 @@ gs_refine_item_management_plugin (GsApp *app, AsApp *item)
  * gs_appstream_refine_app:
  */
 gboolean
-gs_appstream_refine_app (GsPlugin *plugin, GsApp *app, AsApp *item, GError **error)
+gs_appstream_refine_app (GsPlugin *plugin,
+                        GsApp *app,
+                        AsApp *item,
+                        GError **error)
 {
        AsRelease *rel;
        GHashTable *urls;
@@ -368,14 +371,10 @@ gs_appstream_refine_app (GsPlugin *plugin, GsApp *app, AsApp *item, GError **err
        const gchar *tmp;
        guint i;
 
-       /* is an app */
+       /* set the kind to be more precise */
        if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN ||
            gs_app_get_kind (app) == AS_APP_KIND_GENERIC) {
-               if (as_app_get_kind (item) == AS_APP_KIND_SOURCE) {
-                       gs_app_set_kind (app, AS_APP_KIND_SOURCE);
-               } else {
-                       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
-               }
+               gs_app_set_kind (app, as_app_get_kind (item));
        }
 
        /* is installed already */
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 5a0ff1b..2e49158 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -447,7 +447,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
        app = gs_app_new (NULL);
        gs_app_set_management_plugin (app, "fwupd");
        gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
-       gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+       gs_app_set_kind (app, AS_APP_KIND_FIRMWARE);
        g_variant_get (val, "(a{sv})", &iter);
        while (g_variant_iter_next (iter, "{&sv}", &key, &variant)) {
                gs_plugin_fwupd_set_app_from_kv (app, key, variant);


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