summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-12-10 13:16:08 +0000
committerRichard Hughes <richard@hughsie.com>2014-12-10 13:16:41 +0000
commiteef40d2bc15a08818b6e14e240c07de0fe276325 (patch)
tree09fda10c2cec2262c7c1b3e9383a4f794b2c5f19
parent284890c2936a6b98b66ce005e5fac8a33407e998 (diff)
downloadappstream-glib-eef40d2bc15a08818b6e14e240c07de0fe276325.tar.gz
Output the full filename for local icons
This is the same as the recent 'remote' icon fix.
-rw-r--r--data/tests/Makefile.am1
-rw-r--r--data/tests/extra-appdata/local.xml12
-rw-r--r--libappstream-builder/asb-self-test.c12
-rw-r--r--libappstream-glib/as-icon.c5
4 files changed, 29 insertions, 1 deletions
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am
index 6fce485..5e14c74 100644
--- a/data/tests/Makefile.am
+++ b/data/tests/Makefile.am
@@ -19,6 +19,7 @@ test_files = \
example-v06.yml.gz \
example.yml \
extra-appdata/test.xml \
+ extra-appdata/local.xml \
font-1-1.fc21.noarch.rpm \
font-serif-1-1.fc21.noarch.rpm \
intltool.appdata.xml.in \
diff --git a/data/tests/extra-appdata/local.xml b/data/tests/extra-appdata/local.xml
new file mode 100644
index 0000000..24daaee
--- /dev/null
+++ b/data/tests/extra-appdata/local.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components version="0.8" origin="">
+<component type="webapp">
+<id>epiphany-local.desktop</id>
+<metadata_license>CC0-1.0</metadata_license>
+<name>Local</name>
+<summary>My local webapp</summary>
+<description><p>This is awesome</p></description>
+<icon type="local">/usr/share/icons/hicolor/256x256/apps/fedora-logo-icon.png</icon>
+<url type="homepage">http://www.hughski.com/</url>
+</component>
+</components>
diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c
index cb0cc4f..11862c0 100644
--- a/libappstream-builder/asb-self-test.c
+++ b/libappstream-builder/asb-self-test.c
@@ -793,15 +793,25 @@ asb_test_context_extra_appstream_func (void)
ret = as_store_from_file (store, file, NULL, NULL, &error);
g_assert_no_error (error);
g_assert (ret);
- g_assert_cmpint (as_store_get_size (store), ==, 1);
+ g_assert_cmpint (as_store_get_size (store), ==, 2);
app = as_store_get_app_by_id (store, "epiphany-test.desktop");
g_assert (app != NULL);
+ app = as_store_get_app_by_id (store, "epiphany-local.desktop");
+ g_assert (app != NULL);
/* check it matches what we expect */
xml = as_store_to_xml (store, AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE);
expected_xml =
"<components version=\"0.8\" builder_id=\"appstream-glib:4\" origin=\"asb-self-test\">\n"
"<component type=\"webapp\">\n"
+ "<id>epiphany-local.desktop</id>\n"
+ "<name>Local</name>\n"
+ "<summary>My local webapp</summary>\n"
+ "<description><p>This is awesome</p></description>\n"
+ "<icon type=\"local\">/usr/share/icons/hicolor/256x256/apps/fedora-logo-icon.png</icon>\n"
+ "<url type=\"homepage\">http://www.hughski.com/</url>\n"
+ "</component>\n"
+ "<component type=\"webapp\">\n"
"<id>epiphany-test.desktop</id>\n"
"<name>Test</name>\n"
"<summary>Please use my awesome webapp</summary>\n"
diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c
index 2735f7b..ece4d4a 100644
--- a/libappstream-glib/as-icon.c
+++ b/libappstream-glib/as-icon.c
@@ -545,6 +545,11 @@ as_icon_node_insert (AsIcon *icon, GNode *parent, gdouble api_version)
"type", as_icon_kind_to_string (priv->kind),
NULL);
break;
+ case AS_ICON_KIND_LOCAL:
+ n = as_node_insert (parent, "icon", priv->filename, 0,
+ "type", as_icon_kind_to_string (priv->kind),
+ NULL);
+ break;
default:
n = as_node_insert (parent, "icon", priv->name, 0,
"type", as_icon_kind_to_string (priv->kind),