[gnome-software] Copy all the AppStream application metadata items
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Copy all the AppStream application metadata items
- Date: Thu, 1 Oct 2015 13:27:34 +0000 (UTC)
commit dd905fca3a174814768e6562e67363d0bbbf6bd6
Author: Richard Hughes <richard hughsie com>
Date: Thu Oct 1 14:26:16 2015 +0100
Copy all the AppStream application metadata items
This lets us store private metadata and use it in the different plugins,
for example X-Steam-Size.
src/plugins/gs-plugin-appstream.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 4a00f56..c67d7d9 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -453,6 +453,25 @@ gs_plugin_appstream_are_screenshots_perfect (AsApp *app)
}
/**
+ * gs_plugin_appstream_copy_metadata:
+ */
+static void
+gs_plugin_appstream_copy_metadata (GsApp *app, AsApp *item)
+{
+ GHashTable *hash;
+ GList *l;
+ g_autoptr(GList) keys = NULL;
+
+ hash = as_app_get_metadata (item);
+ keys = g_hash_table_get_keys (hash);
+ for (l = keys; l != NULL; l = l->next) {
+ const gchar *key = l->data;
+ const gchar *value = g_hash_table_lookup (hash, key);
+ gs_app_set_metadata (app, key, value);
+ }
+}
+
+/**
* gs_plugin_refine_item:
*/
static gboolean
@@ -590,6 +609,9 @@ gs_plugin_refine_item (GsPlugin *plugin,
if (gs_app_get_id_kind (app) == AS_ID_KIND_UNKNOWN)
gs_app_set_id_kind (app, as_app_get_id_kind (item));
+ /* copy all the metadata */
+ gs_plugin_appstream_copy_metadata (app, item);
+
/* set package names */
pkgnames = as_app_get_pkgnames (item);
if (pkgnames->len > 0 && gs_app_get_sources(app)->len == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]