summaryrefslogtreecommitdiff
path: root/libappstream-builder/plugins
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-09-05 09:16:21 +0100
committerRichard Hughes <richard@hughsie.com>2016-09-05 09:57:56 +0100
commit0076c8b8b79faea1c435bf8c5c34b481a53733a2 (patch)
tree1cd8973b7a915fdc30479b88f9a60f1c4f4f14e2 /libappstream-builder/plugins
parentdfe2de8965b9e0d9d5f18d374c712a0ac2b23e4f (diff)
downloadappstream-glib-0076c8b8b79faea1c435bf8c5c34b481a53733a2.tar.gz
Convert the built unknown icons to the correct kind depending on the action
For building we want ->CACHED, for parsing local files we want ->STOCK. Fixes the other half of https://github.com/hughsie/appstream-glib/pull/128
Diffstat (limited to 'libappstream-builder/plugins')
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index 74ed620..628430d 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -176,7 +176,9 @@ asb_plugin_desktop_refine (AsbPlugin *plugin,
AsIcon *icon;
AsAppParseFlags parse_flags = AS_APP_PARSE_FLAG_USE_HEURISTICS |
AS_APP_PARSE_FLAG_ALLOW_VETO;
+ GPtrArray *icons;
gboolean ret;
+ guint i;
g_autoptr(AsApp) desktop_app = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
@@ -189,6 +191,14 @@ asb_plugin_desktop_refine (AsbPlugin *plugin,
if (!as_app_parse_file (desktop_app, filename, parse_flags, error))
return FALSE;
+ /* convert any UNKNOWN icons to CACHED */
+ icons = as_app_get_icons (AS_APP (desktop_app));
+ for (i = 0; i < icons->len; i++) {
+ icon = g_ptr_array_index (icons, i);
+ if (as_icon_get_kind (icon) == AS_ICON_KIND_UNKNOWN)
+ as_icon_set_kind (icon, AS_ICON_KIND_CACHED);
+ }
+
/* copy all metadata */
as_app_subsume_full (AS_APP (app), desktop_app,
AS_APP_SUBSUME_FLAG_NO_OVERWRITE |