From 0076c8b8b79faea1c435bf8c5c34b481a53733a2 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 5 Sep 2016 09:16:21 +0100 Subject: 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 --- libappstream-glib/as-store.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libappstream-glib/as-store.c') diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c index 7ac5d2f..33278a8 100644 --- a/libappstream-glib/as-store.c +++ b/libappstream-glib/as-store.c @@ -2532,6 +2532,8 @@ as_store_load_installed (AsStore *store, while ((tmp = g_dir_read_name (dir)) != NULL) { AsApp *app_tmp; + GPtrArray *icons; + guint i; g_autofree gchar *filename = NULL; g_autoptr(AsApp) app = NULL; filename = g_build_filename (path, tmp, NULL); @@ -2562,6 +2564,14 @@ as_store_load_installed (AsStore *store, return FALSE; } + /* convert any UNKNOWN icons to LOCAL */ + icons = as_app_get_icons (app); + for (i = 0; i < icons->len; i++) { + AsIcon *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_STOCK); + } + /* don't match against non-package apps in the store */ if (scope == AS_APP_SCOPE_SYSTEM && g_str_has_prefix (path, "/usr/share")) { -- cgit v1.2.1