diff options
author | Joaquim Rocha <jrocha@endlessm.com> | 2016-07-12 17:11:42 +0100 |
---|---|---|
committer | Joaquim Rocha <jrocha@endlessm.com> | 2016-07-12 23:19:32 +0100 |
commit | 6c737a36ec208f3f214365e2058b1a0707b8ffa6 (patch) | |
tree | 808760e358e55fd0d1d3ab8d34d4219b0c143b47 | |
parent | 01a8ab188abf865b4387cd2d1915b789f6f145bf (diff) | |
download | appstream-glib-6c737a36ec208f3f214365e2058b1a0707b8ffa6.tar.gz |
Add external (X-*) keys of an app's desktop file as metadata AsApp
This is helpful for use-cases where those keys are needed by users of
the library.
-rw-r--r-- | libappstream-glib/as-app-desktop.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c index 990b2c5..f2133b5 100644 --- a/libappstream-glib/as-app-desktop.c +++ b/libappstream-glib/as-app-desktop.c @@ -347,6 +347,16 @@ as_app_parse_file_key (AsApp *app, as_app_add_veto (app, "X-AppStream-Ignore"); } + /* Add any external attribute as metadata to the application */ + if (g_str_has_prefix (key, "X-")) { + g_autofree value = NULL; + value = g_key_file_get_string (kf, + G_KEY_FILE_DESKTOP_GROUP, + key, + NULL); + as_app_add_metadata (key, value); + } + return TRUE; } |