[gnome-software] Assign a Kudo for an AppData-based description



commit 0025cfdf4fc30436ae9d85f676ce748a7a645f38
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 2 17:04:21 2015 +0000

    Assign a Kudo for an AppData-based description
    
    Debian-based systems will typically be using the distro description for most
    packages.

 src/gs-app.c                      |    2 ++
 src/gs-app.h                      |    1 +
 src/gs-plugin-loader.c            |    4 +++-
 src/plugins/gs-plugin-appstream.c |    1 +
 4 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 10a1c67..2b54992 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -209,6 +209,8 @@ gs_app_to_string (GsApp *app)
                g_string_append (str, "\tkudo:\tperfect-screenshots\n");
        if ((priv->kudos & GS_APP_KUDO_HIGH_CONTRAST) > 0)
                g_string_append (str, "\tkudo:\thigh-contrast\n");
+       if ((priv->kudos & GS_APP_KUDO_APPDATA_DESCRIPTION) > 0)
+               g_string_append (str, "\tkudo:\tappdata-description\n");
        g_string_append_printf (str, "\tkudo-percentage:\t%i\n",
                                gs_app_get_kudos_percentage (app));
        if (priv->name != NULL)
diff --git a/src/gs-app.h b/src/gs-app.h
index 0d946c3..d0941b4 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -89,6 +89,7 @@ typedef enum {
        GS_APP_KUDO_IBUS_HAS_SYMBOL             = 1 << 11,
        GS_APP_KUDO_PERFECT_SCREENSHOTS         = 1 << 12,
        GS_APP_KUDO_HIGH_CONTRAST               = 1 << 13,
+       GS_APP_KUDO_APPDATA_DESCRIPTION         = 1 << 14,
        GS_APP_KUDO_LAST
 } GsAppKudo;
 
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index f86795e..49e9f09 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -743,7 +743,9 @@ gs_plugin_loader_get_app_is_compatible (GsApp *app, gpointer user_data)
 static gboolean
 gs_plugin_loader_get_app_has_appdata (GsApp *app, gpointer user_data)
 {
-       if (gs_app_get_description (app) != NULL)
+       if (gs_app_get_state (app) != AS_APP_STATE_AVAILABLE)
+               return TRUE;
+       if (gs_app_get_kudos (app) & GS_APP_KUDO_APPDATA_DESCRIPTION)
                return TRUE;
        g_debug ("removing app with no AppData %s", gs_app_get_id (app));
        return FALSE;
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 50c9423..83d239a 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -610,6 +610,7 @@ gs_plugin_refine_item (GsPlugin *plugin,
                        g_prefix_error (error, "trying to parse '%s': ", tmp);
                        return FALSE;
                }
+               gs_app_add_kudo (app, GS_APP_KUDO_APPDATA_DESCRIPTION);
                gs_app_set_description (app,
                                        GS_APP_QUALITY_HIGHEST,
                                        from_xml);


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