diff options
author | Richard Hughes <richard@hughsie.com> | 2015-06-16 15:58:24 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-06-16 15:58:24 +0100 |
commit | ee2d49de66b56e83ee069ff5edc66a145081ae02 (patch) | |
tree | 4009f7585b4dcd75887e291204194f2077049312 | |
parent | 5f58ca667a9de9a99aa206217d9cdb9bc031c0de (diff) | |
download | appstream-glib-ee2d49de66b56e83ee069ff5edc66a145081ae02.tar.gz |
When building metadata with the use-fallback flag accept legacy icon names
-rw-r--r-- | libappstream-glib/as-app-desktop.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c index f2b3690..cb7851c 100644 --- a/libappstream-glib/as-app-desktop.c +++ b/libappstream-glib/as-app-desktop.c @@ -98,12 +98,34 @@ as_app_infer_file_key (AsApp *app, } /** + * _as_utils_is_stock_icon_name_fallback: + **/ +static gboolean +_as_utils_is_stock_icon_name_fallback (const gchar *name) +{ + guint i; + const gchar *names[] = { + "fedora-logo-sprite", + "gtk-preferences", + "hwinfo", + "trash-empty", + "utilities-log-viewer", + NULL }; + for (i = 0; names[i] != NULL; i++) { + if (g_strcmp0 (name, names[i]) == 0) + return TRUE; + } + return FALSE; +} + +/** * as_app_parse_file_key: **/ static gboolean as_app_parse_file_key (AsApp *app, GKeyFile *kf, const gchar *key, + AsAppParseFlags flags, GError **error) { gchar *dot = NULL; @@ -152,6 +174,10 @@ as_app_parse_file_key (AsApp *app, if (as_utils_is_stock_icon_name (tmp)) { as_icon_set_name (icon, tmp, -1); as_icon_set_kind (icon, AS_ICON_KIND_STOCK); + } else if ((flags & AS_APP_PARSE_FLAG_USE_FALLBACKS) > 0 && + _as_utils_is_stock_icon_name_fallback (tmp)) { + as_icon_set_name (icon, tmp, -1); + as_icon_set_kind (icon, AS_ICON_KIND_STOCK); } else { as_icon_set_kind (icon, AS_ICON_KIND_LOCAL); } @@ -406,7 +432,7 @@ as_app_parse_desktop_file (AsApp *app, if (keys == NULL) return FALSE; for (i = 0; keys[i] != NULL; i++) { - if (!as_app_parse_file_key (app, kf, keys[i], error)) + if (!as_app_parse_file_key (app, kf, keys[i], flags, error)) return FALSE; if ((flags & AS_APP_PARSE_FLAG_USE_HEURISTICS) > 0) { if (!as_app_infer_file_key (app, kf, keys[i], error)) |