From 412a99d2c6ec377d98b3ceb9009ce62fc1d17f5d Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 16 Apr 2018 16:13:43 +0100 Subject: Never add more than one component to the AppStream store when composing If the app has an AppData file with org.gnome.Gimp.appdata.xml that contains org.gnome.Gimp and also a org.gnome.Gimp.desktop then the second gets added as a new component as the .desktop suffix is optional, but allowed for compatibility. Just rename the .desktop component ID in this case to force the app to be subsumed rather than added. --- client/as-compose.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/as-compose.c b/client/as-compose.c index 512a7f1..8526c08 100644 --- a/client/as-compose.c +++ b/client/as-compose.c @@ -497,6 +497,12 @@ main (int argc, char **argv) if (g_hash_table_size (as_app_get_comments (app_appdata)) > 0) g_hash_table_remove_all (as_app_get_comments (app_desktop)); + /* does the app already exist with a launchable that matches this ID */ + if (g_strcmp0 (as_app_get_id (app_appdata), as_app_get_id (app_desktop)) != 0) { + g_debug ("fixing up ID for desktop merge"); + as_app_set_id (app_desktop, as_app_get_id (app_appdata)); + } + as_store_add_app (store, app_desktop); } } -- cgit v1.2.1