diff options
author | Richard Hughes <richard@hughsie.com> | 2014-04-22 18:29:00 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-04-22 18:29:00 +0100 |
commit | 07974c197f39da2d69d4c5f606e5b5d8caae3ea7 (patch) | |
tree | 3e78e443d8ef19e8cdb0ea850fa6b59477bd206f | |
parent | 01f3d5921e568cdbe99c1a730fb13eb52dc54db7 (diff) | |
download | appstream-glib-07974c197f39da2d69d4c5f606e5b5d8caae3ea7.tar.gz |
Support the AppStream 0.6.1 property attribute
-rw-r--r-- | libappstream-glib/as-app.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 52f4d9e..df6388d 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -1406,7 +1406,11 @@ as_app_node_insert (AsApp *app, GNode *parent, gdouble api_version) if (priv->priority != 0) { gchar prio[6]; g_snprintf (prio, sizeof (prio), "%i", priv->priority); - as_node_insert (node_app, "priority", prio, 0, NULL); + if (api_version >= 0.61) { + as_node_add_attribute (node_app, "priority", prio, -1); + } else { + as_node_insert (node_app, "priority", prio, 0, NULL); + } } /* <pkgname> */ @@ -1800,12 +1804,16 @@ as_app_node_parse (AsApp *app, GNode *node, GError **error) GNode *n; const gchar *tmp; gboolean ret = TRUE; + guint prio; /* new style */ if (g_strcmp0 (as_node_get_name (node), "component") == 0) { tmp = as_node_get_attribute (node, "type"); if (tmp != NULL) as_app_set_id_kind (app, as_id_kind_from_string (tmp)); + prio = as_node_get_attribute_as_int (node, "priority"); + if (prio != G_MAXUINT && prio != 0) + as_app_set_priority (app, prio); } /* parse each node */ |