[gnome-software] Set the origin from the AppStream file if set
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Set the origin from the AppStream file if set
- Date: Fri, 17 Feb 2017 12:14:51 +0000 (UTC)
commit b4f0def4920b6f5fbd704cee6572364e6f402a11
Author: Richard Hughes <richard hughsie com>
Date: Thu Feb 16 16:39:19 2017 +0000
Set the origin from the AppStream file if set
This allows us to work out the provenance without doing a constly call to
PackageKit for each application result. In the details shell we'll be doing
this anyway, but for search results we want the results to be fast.
src/plugins/gs-appstream.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index dcbaccb..43a50ea 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -511,6 +511,16 @@ gs_appstream_get_bundle_kind (AsApp *item)
return AS_BUNDLE_KIND_UNKNOWN;
}
+static gboolean
+gs_appstream_origin_valid (const gchar *origin)
+{
+ if (origin == NULL)
+ return FALSE;
+ if (g_strcmp0 (origin, "") == 0)
+ return FALSE;
+ return TRUE;
+}
+
gboolean
gs_appstream_refine_app (GsPlugin *plugin,
GsApp *app,
@@ -797,6 +807,11 @@ gs_appstream_refine_app (GsPlugin *plugin,
if (tmp != NULL && gs_app_get_origin_hostname (app) == NULL)
gs_app_set_origin_hostname (app, tmp);
+ /* we have an origin in the XML */
+ if (gs_app_get_origin (app) == NULL &&
+ gs_appstream_origin_valid (as_app_get_origin (item)))
+ gs_app_set_origin (app, as_app_get_origin (item));
+
/* is there any update information */
if (!gs_appstream_refine_app_updates (plugin, app, item, error))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]