summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-screenshot.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-04-20 21:48:44 +0100
committerRichard Hughes <richard@hughsie.com>2014-04-20 21:48:44 +0100
commit78175b5b6a97aa4b58fde67a47fdba89b5f74a46 (patch)
treef6c9d3b7084884a0a386525c6689e569c663d23b /libappstream-glib/as-screenshot.c
parent0157ae4ec75a78a4889f115b79dd471f095ecf8c (diff)
downloadappstream-glib-78175b5b6a97aa4b58fde67a47fdba89b5f74a46.tar.gz
Support <screenshot> sections without <image>'s
This allows us to verify AppData files which only have source URLs.
Diffstat (limited to 'libappstream-glib/as-screenshot.c')
-rw-r--r--libappstream-glib/as-screenshot.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libappstream-glib/as-screenshot.c b/libappstream-glib/as-screenshot.c
index c6ef476..596c007 100644
--- a/libappstream-glib/as-screenshot.c
+++ b/libappstream-glib/as-screenshot.c
@@ -34,7 +34,7 @@
#include "config.h"
#include "as-image-private.h"
-#include "as-node.h"
+#include "as-node-private.h"
#include "as-screenshot-private.h"
#include "as-tag.h"
#include "as-utils-private.h"
@@ -321,6 +321,19 @@ as_screenshot_node_parse (AsScreenshot *screenshot, GNode *node, GError **error)
g_list_free (keys);
}
+ /* AppData files does not have <image> tags */
+ tmp = as_node_get_data (node);
+ if (tmp != NULL) {
+ image = as_image_new ();
+ as_image_set_kind (image, AS_IMAGE_KIND_SOURCE);
+ as_image_set_width (image,
+ as_node_get_attribute_as_int (node, "width"));
+ as_image_set_height (image,
+ as_node_get_attribute_as_int (node, "height"));
+ as_image_set_url (image, tmp, -1);
+ g_ptr_array_add (priv->images, image);
+ }
+
/* add images */
for (c = node->children; c != NULL; c = c->next) {
if (as_node_get_tag (c) != AS_TAG_IMAGE)