summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-04-16 16:11:21 +0100
committerRichard Hughes <richard@hughsie.com>2018-04-18 18:25:46 +0100
commitf4bd5f611645eb394ac0419d848aba7fda91ccee (patch)
treea0c1349d499454fa2055f62c4513cf0c35e78d17
parent7bcba4d2f90c3b02882277739d46af6bd7146a11 (diff)
downloadappstream-glib-f4bd5f611645eb394ac0419d848aba7fda91ccee.tar.gz
If the launchable is specified don't guess it when composing
This allows us to have an appdata file with <id>org.gnome.Gimp</id> without being forced to rename the gimp.desktop file.
-rw-r--r--client/as-compose.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/client/as-compose.c b/client/as-compose.c
index fecc752..512a7f1 100644
--- a/client/as-compose.c
+++ b/client/as-compose.c
@@ -400,13 +400,13 @@ main (int argc, char **argv)
/* load each application specified */
for (i = 1; i < (guint) argc; i++) {
+ AsLaunchable *launchable;
const gchar *app_name = argv[i];
g_auto(GStrv) intl_domains = NULL;
g_autoptr(AsApp) app_appdata = NULL;
g_autoptr(AsApp) app_desktop = NULL;
g_autoptr(GString) desktop_basename = NULL;
g_autofree gchar *desktop_path = NULL;
- const gchar *appdata_id;
/* TRANSLATORS: we're generating the AppStream data */
g_print ("%s %s\n", _("Processing application"), app_name);
@@ -458,12 +458,19 @@ main (int argc, char **argv)
as_store_add_app (store, app_appdata);
/* use the ID from the AppData file if it was found */
- appdata_id = as_app_get_id (app_appdata);
- desktop_basename = g_string_new (appdata_id != NULL ? appdata_id : app_name);
+ launchable = as_app_get_launchable_by_kind (app_appdata,
+ AS_LAUNCHABLE_KIND_DESKTOP_ID);
+ if (launchable != NULL) {
+ desktop_basename = g_string_new (as_launchable_get_value (launchable));
+ } else {
+ const gchar *appdata_id = as_app_get_id (app_appdata);
+
+ /* append the .desktop suffix if using a new-style name */
+ desktop_basename = g_string_new (appdata_id != NULL ? appdata_id : app_name);
+ if (!g_str_has_suffix (desktop_basename->str, ".desktop"))
+ g_string_append (desktop_basename, ".desktop");
+ }
- /* append the .desktop suffix if using a new-style name */
- if (!g_str_has_suffix (desktop_basename->str, ".desktop"))
- g_string_append (desktop_basename, ".desktop");
desktop_path = g_build_filename (prefix, "share", "applications",
desktop_basename->str, NULL);
g_debug ("looking for %s", desktop_path);