[gnome-software] Allow multiple plugins to set the name, summary and description



commit 61a150731a6a1050165ad3a368f7ffc042a05b7b
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jan 29 15:16:01 2014 +0000

    Allow multiple plugins to set the name, summary and description
    
    Only the plugin with the highest 'data quality' will win. This allows us to
    nuke some more metadata and also take some internal assumptions out of the code.

 src/gs-app.c                               |   49 ++++++++++++++++++++++-----
 src/gs-app.h                               |   11 ++++++
 src/gs-plugin-loader.c                     |   20 ++++++++---
 src/gs-self-test.c                         |   10 +++++-
 src/gs-shell-details.c                     |    1 +
 src/plugins/gs-plugin-appdata.c            |   28 +++++++--------
 src/plugins/gs-plugin-appstream.c          |   21 ++++++++---
 src/plugins/gs-plugin-datadir-apps.c       |    4 +-
 src/plugins/gs-plugin-dummy.c              |   28 ++++++++--------
 src/plugins/gs-plugin-epiphany.c           |    4 +-
 src/plugins/gs-plugin-packagekit-history.c |    2 +-
 src/plugins/gs-plugin-packagekit-refine.c  |   18 ++++++----
 src/plugins/gs-plugin-packagekit-refresh.c |    8 ++--
 src/plugins/packagekit-common.c            |    9 +++--
 14 files changed, 143 insertions(+), 70 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 05cd63a..6aa1550 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -58,6 +58,7 @@ struct GsAppPrivate
        gchar                   *id;
        gchar                   *id_full;
        gchar                   *name;
+       GsAppQuality             name_quality;
        gchar                   *icon;
        GPtrArray               *sources;
        GPtrArray               *source_ids;
@@ -65,8 +66,10 @@ struct GsAppPrivate
        gchar                   *version;
        gchar                   *version_ui;
        gchar                   *summary;
+       GsAppQuality             summary_quality;
        gchar                   *summary_missing;
        gchar                   *description;
+       GsAppQuality             description_quality;
        GPtrArray               *screenshots;
        GPtrArray               *categories;
        GPtrArray               *keywords;
@@ -575,12 +578,20 @@ gs_app_get_name (GsApp *app)
 /**
  * gs_app_set_name:
  * @app:       A #GsApp instance
+ * @quality:   A data quality, e.g. %GS_APP_QUALITY_LOWEST
  * @name:      The short localized name, e.g. "Calculator"
  */
 void
-gs_app_set_name (GsApp *app, const gchar *name)
+gs_app_set_name (GsApp *app, GsAppQuality quality, const gchar *name)
 {
        g_return_if_fail (GS_IS_APP (app));
+       g_return_if_fail (name != NULL);
+
+       /* only save this if the data is sufficiently high quality */
+       if (quality < app->priv->name_quality)
+               return;
+       app->priv->name_quality = quality;
+
        g_free (app->priv->name);
        app->priv->name = g_strdup (name);
 }
@@ -980,12 +991,19 @@ gs_app_get_summary (GsApp *app)
 /**
  * gs_app_set_summary:
  * @app:       A #GsApp instance
+ * @quality:   A data quality, e.g. %GS_APP_QUALITY_LOWEST
  * @summary:   The medium length localized name, e.g. "A graphical calculator for GNOME"
  */
 void
-gs_app_set_summary (GsApp *app, const gchar *summary)
+gs_app_set_summary (GsApp *app, GsAppQuality quality, const gchar *summary)
 {
        g_return_if_fail (GS_IS_APP (app));
+
+       /* only save this if the data is sufficiently high quality */
+       if (quality < app->priv->summary_quality)
+               return;
+       app->priv->summary_quality = quality;
+
        g_free (app->priv->summary);
        app->priv->summary = g_strdup (summary);
 }
@@ -1003,12 +1021,19 @@ gs_app_get_description (GsApp *app)
 /**
  * gs_app_set_description:
  * @app:       A #GsApp instance
+ * @quality:   A data quality, e.g. %GS_APP_QUALITY_LOWEST
  * @summary:   The multiline localized description, e.g. "GNOME Calculator is a graphical calculator for 
GNOME....."
  */
 void
-gs_app_set_description (GsApp *app, const gchar *description)
+gs_app_set_description (GsApp *app, GsAppQuality quality, const gchar *description)
 {
        g_return_if_fail (GS_IS_APP (app));
+
+       /* only save this if the data is sufficiently high quality */
+       if (quality < app->priv->summary_quality)
+               return;
+       app->priv->summary_quality = quality;
+
        g_free (app->priv->description);
        app->priv->description = g_strdup (description);
 }
@@ -1455,11 +1480,11 @@ gs_app_subsume (GsApp *app, GsApp *other)
        if (priv2->project_group != NULL)
                gs_app_set_project_group (app, priv2->project_group);
        if (priv2->name != NULL)
-               gs_app_set_name (app, priv2->name);
+               gs_app_set_name (app, priv2->name_quality, priv2->name);
        if (priv2->summary != NULL)
-               gs_app_set_summary (app, priv2->summary);
+               gs_app_set_summary (app, priv2->summary_quality, priv2->summary);
        if (priv2->description != NULL)
-               gs_app_set_description (app, priv2->description);
+               gs_app_set_description (app, priv2->description_quality, priv2->description);
        if (priv2->update_details != NULL)
                gs_app_set_update_details (app, priv2->update_details);
        if (priv2->update_version != NULL)
@@ -1535,16 +1560,22 @@ gs_app_set_property (GObject *object, guint prop_id, const GValue *value, GParam
                gs_app_set_id (app, g_value_get_string (value));
                break;
        case PROP_NAME:
-               gs_app_set_name (app, g_value_get_string (value));
+               gs_app_set_name (app,
+                                GS_APP_QUALITY_UNKNOWN,
+                                g_value_get_string (value));
                break;
        case PROP_VERSION:
                gs_app_set_version (app, g_value_get_string (value));
                break;
        case PROP_SUMMARY:
-               gs_app_set_summary (app, g_value_get_string (value));
+               gs_app_set_summary (app,
+                                   GS_APP_QUALITY_UNKNOWN,
+                                   g_value_get_string (value));
                break;
        case PROP_DESCRIPTION:
-               gs_app_set_description (app, g_value_get_string (value));
+               gs_app_set_description (app,
+                                       GS_APP_QUALITY_UNKNOWN,
+                                       g_value_get_string (value));
                break;
        case PROP_RATING:
                gs_app_set_rating (app, g_value_get_int (value));
diff --git a/src/gs-app.h b/src/gs-app.h
index a150811..24e7180 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -103,6 +103,14 @@ typedef enum {
 #define        GS_APP_URL_KIND_HOMEPAGE                "homepage"
 #define        GS_APP_URL_KIND_MISSING                 "missing"
 
+typedef enum {
+       GS_APP_QUALITY_UNKNOWN,
+       GS_APP_QUALITY_LOWEST,
+       GS_APP_QUALITY_NORMAL,
+       GS_APP_QUALITY_HIGHEST,
+       GS_APP_QUALITY_LAST
+} GsAppQuality;
+
 GQuark          gs_app_error_quark             (void);
 GType           gs_app_get_type                (void);
 
@@ -130,6 +138,7 @@ void                 gs_app_set_state               (GsApp          *app,
                                                 GsAppState      state);
 const gchar    *gs_app_get_name                (GsApp          *app);
 void            gs_app_set_name                (GsApp          *app,
+                                                GsAppQuality    quality,
                                                 const gchar    *name);
 const gchar    *gs_app_get_source_default      (GsApp          *app);
 void            gs_app_add_source              (GsApp          *app,
@@ -152,12 +161,14 @@ void               gs_app_set_version             (GsApp          *app,
                                                 const gchar    *version);
 const gchar    *gs_app_get_summary             (GsApp          *app);
 void            gs_app_set_summary             (GsApp          *app,
+                                                GsAppQuality    quality,
                                                 const gchar    *summary);
 const gchar    *gs_app_get_summary_missing     (GsApp          *app);
 void            gs_app_set_summary_missing     (GsApp          *app,
                                                 const gchar    *missing);
 const gchar    *gs_app_get_description         (GsApp          *app);
 void            gs_app_set_description         (GsApp          *app,
+                                                GsAppQuality    quality,
                                                 const gchar    *description);
 const gchar    *gs_app_get_url                 (GsApp          *app,
                                                 const gchar    *kind);
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 53dfe39..8aea0af 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -712,12 +712,20 @@ gs_plugin_loader_add_os_update_item (GList *list)
        app_os = gs_app_new ("os-update.virtual");
        gs_app_set_kind (app_os, GS_APP_KIND_OS_UPDATE);
        gs_app_set_state (app_os, GS_APP_STATE_UPDATABLE);
-       /* TRANSLATORS: this is a group of updates that are not packages and
-        * are ot shown in the main list */
-       gs_app_set_name (app_os, _("OS Updates"));
-       /* TRANSLATORS: this is a longer description of the os-update item */
-       gs_app_set_summary (app_os, _("Includes performance, stability and security improvements for all 
users."));
-       gs_app_set_description (app_os, _("Includes performance, stability and security improvements for all 
users."));
+       gs_app_set_name (app_os,
+                        GS_APP_QUALITY_NORMAL,
+                        /* TRANSLATORS: this is a group of updates that are not
+                         * packages and are not shown in the main list */
+                        _("OS Updates"));
+       gs_app_set_summary (app_os,
+                           GS_APP_QUALITY_NORMAL,
+                           /* TRANSLATORS: this is a longer description of the
+                            * os-update item */
+                           _("Includes performance, stability and security "
+                             "improvements for all users."));
+       gs_app_set_description (app_os,
+                               GS_APP_QUALITY_NORMAL,
+                               gs_app_get_summary (app_os));
        for (l = list; l != NULL; l = l->next) {
                app_tmp = GS_APP (l->data);
                if (gs_app_get_kind (app_tmp) != GS_APP_KIND_PACKAGE)
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 07e49cc..0b24fa0 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -293,6 +293,14 @@ gs_app_func (void)
        g_assert_cmpstr (gs_app_get_version_ui (app), ==, "2.8.6-3");
        g_assert_cmpstr (gs_app_get_update_version_ui (app), ==, "2.8.6-4");
 
+       /* check the quality stuff works */
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "dave");
+       g_assert_cmpstr (gs_app_get_name (app), ==, "dave");
+       gs_app_set_name (app, GS_APP_QUALITY_LOWEST, "brian");
+       g_assert_cmpstr (gs_app_get_name (app), ==, "dave");
+       gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, "hugh");
+       g_assert_cmpstr (gs_app_get_name (app), ==, "hugh");
+
        g_object_unref (app);
 }
 
@@ -318,7 +326,7 @@ gs_plugin_loader_dedupe_func (void)
 
        /* add app */
        app1 = gs_app_new ("app1");
-       gs_app_set_description (app1, "description");
+       gs_app_set_description (app1, GS_APP_QUALITY_NORMAL, "description");
        app1 = gs_plugin_loader_dedupe (loader, app1);
        g_assert_cmpstr (gs_app_get_id (app1), ==, "app1");
        g_assert_cmpstr (gs_app_get_description (app1), ==, "description");
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 7cb650c..c8a9633 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -777,6 +777,7 @@ gs_shell_details_filename_to_app_cb (GObject *source,
 
        /* change widgets */
        gs_shell_details_refresh (shell_details);
+       gs_shell_details_refresh_screenshots (shell_details);
        gs_shell_details_refresh_all (shell_details);
        gs_shell_details_set_state (shell_details, GS_SHELL_DETAILS_STATE_READY);
 }
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index d844562..59ef9c7 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -206,7 +206,9 @@ appdata_parse_end_element_cb (GMarkupParseContext *context,
                                                   APPSTREAM_MARKUP_MODE_END);
                        tmp = appstream_markup_get_text (helper->markup);
                        if (tmp != NULL)
-                               gs_app_set_description (helper->app, tmp);
+                               gs_app_set_description (helper->app,
+                                                       GS_APP_QUALITY_NORMAL,
+                                                       tmp);
                        helper->tag = APPSTREAM_TAG_APPLICATION;
                }
        } else {
@@ -251,23 +253,19 @@ appdata_parse_text_cb (GMarkupParseContext *context,
                break;
        case APPSTREAM_TAG_NAME:
                // FIXME: does not get best language
-               if (gs_app_get_name (helper->app) == NULL) {
-                       tmp = appstream_xml_unmunge (text, text_len);
-                       if (tmp == NULL)
-                               break;
-                       g_debug ("AppData: Setting name: %s", tmp);
-                       gs_app_set_name (helper->app, tmp);
-               }
+               tmp = appstream_xml_unmunge (text, text_len);
+               if (tmp == NULL)
+                       break;
+               g_debug ("AppData: Setting name: %s", tmp);
+               gs_app_set_name (helper->app, GS_APP_QUALITY_NORMAL, tmp);
                break;
        case APPSTREAM_TAG_SUMMARY:
                // FIXME: does not get best language
-               if (gs_app_get_summary (helper->app) == NULL) {
-                       tmp = appstream_xml_unmunge (text, text_len);
-                       if (tmp == NULL)
-                               break;
-                       g_debug ("AppData: Setting summary: %s", tmp);
-                       gs_app_set_summary (helper->app, tmp);
-               }
+               tmp = appstream_xml_unmunge (text, text_len);
+               if (tmp == NULL)
+                       break;
+               g_debug ("AppData: Setting summary: %s", tmp);
+               gs_app_set_summary (helper->app, GS_APP_QUALITY_NORMAL, tmp);
                break;
        case APPSTREAM_TAG_URL:
                if (gs_app_get_url (helper->app, GS_APP_URL_KIND_HOMEPAGE) == NULL) {
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 90b11a0..9b7c400 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -528,12 +528,18 @@ gs_plugin_refine_item (GsPlugin *plugin,
                gs_app_set_id (app, appstream_app_get_id (item));
 
        /* set name */
-       if (appstream_app_get_name (item) != NULL && gs_app_get_name (app) == NULL)
-               gs_app_set_name (app, appstream_app_get_name (item));
+       if (appstream_app_get_name (item) != NULL) {
+               gs_app_set_name (app,
+                                GS_APP_QUALITY_HIGHEST,
+                                appstream_app_get_name (item));
+       }
 
        /* set summary */
-       if (appstream_app_get_summary (item) != NULL && gs_app_get_summary (app) == NULL)
-               gs_app_set_summary (app, appstream_app_get_summary (item));
+       if (appstream_app_get_summary (item) != NULL) {
+               gs_app_set_summary (app,
+                                   GS_APP_QUALITY_HIGHEST,
+                                   appstream_app_get_summary (item));
+       }
 
        /* add urls */
        urls = appstream_app_get_urls (item);
@@ -560,8 +566,11 @@ gs_plugin_refine_item (GsPlugin *plugin,
                gs_app_set_keywords (app, appstream_app_get_keywords (item));
 
        /* set description */
-       if (appstream_app_get_description (item) != NULL && gs_app_get_description (app) == NULL)
-               gs_app_set_description (app, appstream_app_get_description (item));
+       if (appstream_app_get_description (item) != NULL) {
+               gs_app_set_description (app,
+                                       GS_APP_QUALITY_HIGHEST,
+                                       appstream_app_get_description (item));
+       }
 
        /* set icon */
        if (appstream_app_get_icon (item) != NULL && gs_app_get_pixbuf (app) == NULL)
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index 0428252..aef58aa 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -107,11 +107,11 @@ gs_plugin_datadir_apps_set_from_cache_item (GsApp *app,
        gs_app_set_id (app, cache_item->id);
        gs_app_set_metadata (app, "DataDir::desktop-icon", cache_item->icon_name);
        if (cache_item->name != NULL)
-               gs_app_set_name (app, cache_item->name);
+               gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, cache_item->name);
        if (cache_item->pkgname != NULL)
                gs_app_add_source (app, cache_item->pkgname);
        if (cache_item->summary != NULL)
-               gs_app_set_summary (app, cache_item->summary);
+               gs_app_set_summary (app, GS_APP_QUALITY_HIGHEST, cache_item->summary);
        if (cache_item->pixbuf != NULL)
                gs_app_set_pixbuf (app, cache_item->pixbuf);
 
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 81bc6a5..0178fab 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -102,24 +102,24 @@ gs_plugin_add_updates (GsPlugin *plugin,
 
        /* add a normal application */
        app = gs_app_new ("gnome-boxes");
-       gs_app_set_name (app, "Boxes");
-       gs_app_set_summary (app, "Do not segfault when using newer versons of libvirt.");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of 
libvirt.");
        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
        gs_app_set_id_kind (app, GS_APP_ID_KIND_DESKTOP);
        gs_plugin_add_app (list, app);
 
        /* add an OS update */
        app = gs_app_new ("libvirt-glib-devel;0.0.1;noarch;fedora");
-       gs_app_set_name (app, "libvirt-glib-devel");
-       gs_app_set_summary (app, "Fix several memory leaks.");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "libvirt-glib-devel");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Fix several memory leaks.");
        gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
        gs_app_set_id_kind (app, GS_APP_ID_KIND_DESKTOP);
        gs_plugin_add_app (list, app);
 
        /* add a second OS update */
        app = gs_app_new ("gnome-boxes-libs;0.0.1;i386;updates-testing");
-       gs_app_set_name (app, "gnome-boxes-libs");
-       gs_app_set_summary (app, "Do not segfault when using newer versons of libvirt.");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "gnome-boxes-libs");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of 
libvirt.");
        gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
        gs_app_set_id_kind (app, GS_APP_ID_KIND_DESKTOP);
        gs_plugin_add_app (list, app);
@@ -139,8 +139,8 @@ gs_plugin_add_installed (GsPlugin *plugin,
        GsApp *app;
 
        app = gs_app_new ("gnome-power-manager");
-       gs_app_set_name (app, "Power Manager");
-       gs_app_set_summary (app, "Power Management Program");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
        gs_plugin_add_app (list, app);
@@ -161,8 +161,8 @@ gs_plugin_add_popular (GsPlugin *plugin,
        GsApp *app;
 
        app = gs_app_new ("gnome-power-manager");
-       gs_app_set_name (app, "Power Manager");
-       gs_app_set_summary (app, "Power Management Program");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
        gs_plugin_add_app (list, app);
@@ -188,8 +188,8 @@ gs_plugin_refine (GsPlugin *plugin,
                app = GS_APP (l->data);
                if (gs_app_get_name (app) == NULL) {
                        if (g_strcmp0 (gs_app_get_id (app), "gnome-boxes") == 0) {
-                               gs_app_set_name (app, "Boxes");
-                               gs_app_set_summary (app, "A simple GNOME 3 application to access remote or 
virtual systems");
+                               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
+                               gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "A simple GNOME 3 application 
to access remote or virtual systems");
                        }
                }
        }
@@ -208,8 +208,8 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
 {
        GsApp *app;
        app = gs_app_new ("gnome-boxes");
-       gs_app_set_name (app, "Boxes");
-       gs_app_set_summary (app, "View and use virtual machines");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
        gs_app_set_url (app, GS_APP_URL_KIND_HOMEPAGE, "http://www.box.org";);
        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 0f43828..5a723c6 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -154,8 +154,8 @@ gs_plugin_add_installed_file (GsPlugin *plugin,
 
        /* create application */
        *app = gs_app_new (filename);
-       gs_app_set_name (*app, name);
-       gs_app_set_summary (*app, comment);
+       gs_app_set_name (*app, GS_APP_QUALITY_NORMAL, name);
+       gs_app_set_summary (*app, GS_APP_QUALITY_NORMAL, comment);
        /* TRANSLATORS: this is the licence of the web-app */
        gs_app_set_licence (*app, _("Proprietary"));
        gs_app_set_state (*app, no_display ? GS_APP_STATE_AVAILABLE :
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index 2717a92..fdf6896 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -85,7 +85,7 @@ gs_plugin_packagekit_refine_add_history (GsApp *app, GVariant *dict)
        /* create new history item with same ID as parent */
        history = gs_app_new (gs_app_get_id_full (app));
        gs_app_set_kind (history, GS_APP_KIND_PACKAGE);
-       gs_app_set_name (history, gs_app_get_name (app));
+       gs_app_set_name (history, GS_APP_QUALITY_NORMAL, gs_app_get_name (app));
 
        /* get the installed state */
        ret = g_variant_lookup (dict, "info", "u", &info_enum);
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index b1126cc..bce7fe3 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -147,8 +147,12 @@ gs_plugin_packagekit_resolve_packages_app (GPtrArray *packages,
                                if (gs_app_get_version (app) == NULL)
                                        gs_app_set_version (app,
                                                pk_package_get_version (package));
-                               gs_app_set_metadata (app, "PackageKit::Summary",
-                                                    pk_package_get_summary (package));
+                               gs_app_set_name (app,
+                                                GS_APP_QUALITY_LOWEST,
+                                                pk_package_get_name (package));
+                               gs_app_set_summary (app,
+                                                   GS_APP_QUALITY_LOWEST,
+                                                   pk_package_get_summary (package));
                        }
                }
        }
@@ -455,11 +459,11 @@ gs_plugin_packagekit_refine_details_app (GsPlugin *plugin,
                                                pk_details_get_url (details));
                        }
                        size += pk_details_get_size (details);
-                       if (gs_app_get_metadata_item (app, "PackageKit::Description") == NULL) {
-                               desc = gs_pk_format_desc (pk_details_get_description (details));
-                               gs_app_set_metadata (app, "PackageKit::Description", desc);
-                               g_free (desc);
-                       }
+                       desc = gs_pk_format_desc (pk_details_get_description (details));
+                       gs_app_set_description (app,
+                                               GS_APP_QUALITY_LOWEST,
+                                               desc);
+                       g_free (desc);
                        break;
                }
        }
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index e73e138..c8cf665 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -187,12 +187,12 @@ gs_plugin_packagekit_refresh_set_text (GsApp *app, const gchar *text)
        tmp = g_strdup (text);
        nl = g_strstr_len (tmp, -1, "\n");
        if (nl == NULL) {
-               gs_app_set_summary (app, text);
+               gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, text);
                goto out;
        }
        *nl = '\0';
-       gs_app_set_summary (app, tmp);
-       gs_app_set_description (app, nl + 1);
+       gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, tmp);
+       gs_app_set_description (app, GS_APP_QUALITY_LOWEST, nl + 1);
 out:
        g_free (tmp);
 }
@@ -257,7 +257,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
        gs_app_set_management_plugin (app, "PackageKit");
        gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
        gs_app_set_state (app, GS_APP_STATE_LOCAL);
-       gs_app_set_name (app, split[PK_PACKAGE_ID_NAME]);
+       gs_app_set_name (app, GS_APP_QUALITY_LOWEST, split[PK_PACKAGE_ID_NAME]);
        gs_app_set_version (app, split[PK_PACKAGE_ID_VERSION]);
        gs_app_set_metadata (app, "PackageKit::local-filename", filename);
        gs_app_add_source (app, split[PK_PACKAGE_ID_NAME]);
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index f804849..a3de9bb 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -146,9 +146,12 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
                app = gs_app_new (NULL);
                gs_app_add_source (app, pk_package_get_name (package));
                gs_app_add_source_id (app, pk_package_get_id (package));
-               gs_app_set_metadata (app,
-                                    "PackageKit::package-summary",
-                                    pk_package_get_summary (package));
+               gs_app_set_name (app,
+                                GS_APP_QUALITY_LOWEST,
+                                pk_package_get_name (package));
+               gs_app_set_summary (app,
+                                   GS_APP_QUALITY_LOWEST,
+                                   pk_package_get_summary (package));
                gs_app_set_management_plugin (app, "PackageKit");
                gs_app_set_version (app, pk_package_get_version (package));
                switch (pk_package_get_info (package)) {


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