summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-09-15 15:12:24 +0100
committerRichard Hughes <richard@hughsie.com>2016-09-15 15:12:26 +0100
commit4b577d96e3502df08fa0598d878102dc69a1f4bb (patch)
treeb6049ad70e530fbd88a48d47185e344bf46ea6b9
parent00748671c01c2cc903b2103ff6fe2e79cd8f7ffe (diff)
downloadappstream-glib-4b577d96e3502df08fa0598d878102dc69a1f4bb.tar.gz
trivial: Fix building AppStream metadata when using local files
Since we fixed the icon kind issue we just have to be a bit more careful when reading out what name to use.
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c14
-rw-r--r--libappstream-glib/as-utils.c3
2 files changed, 14 insertions, 3 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index 628430d..8e7312f 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -207,14 +207,22 @@ asb_plugin_desktop_refine (AsbPlugin *plugin,
/* is the icon a stock-icon-name? */
icon = as_app_get_icon_default (AS_APP (app));
if (icon != NULL) {
- g_autofree gchar *key = NULL;
- key = g_strdup (as_icon_get_name (icon));
if (as_icon_get_kind (icon) == AS_ICON_KIND_STOCK) {
asb_package_log (pkg,
ASB_PACKAGE_LOG_LEVEL_DEBUG,
- "using stock icon %s", key);
+ "using stock icon %s",
+ as_icon_get_name (icon));
} else {
+ g_autofree gchar *key = NULL;
g_autoptr(GError) error_local = NULL;
+ switch (as_icon_get_kind (icon)) {
+ case AS_ICON_KIND_LOCAL:
+ key = g_strdup (as_icon_get_filename (icon));
+ break;
+ default:
+ key = g_strdup (as_icon_get_name (icon));
+ break;
+ }
g_ptr_array_set_size (as_app_get_icons (AS_APP (app)), 0);
ret = asb_plugin_desktop_add_icons (plugin,
app,
diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c
index 6ec25cf..2241911 100644
--- a/libappstream-glib/as-utils.c
+++ b/libappstream-glib/as-utils.c
@@ -892,6 +892,9 @@ as_utils_find_icon_filename_full (const gchar *destdir,
NULL };
g_autofree gchar *prefix = NULL;
+ g_return_val_if_fail (destdir != NULL, NULL);
+ g_return_val_if_fail (search != NULL, NULL);
+
/* fallback */
if (destdir == NULL)
destdir = "";