diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-03-16 15:44:48 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-01-23 11:48:54 -0500 |
commit | 87fce691e3ff31d9c365147a83d9a6d50c2020e0 (patch) | |
tree | 3d4b9cba89f5eeff75debc0e9413dfe49893d375 | |
parent | 3f9304ddc9a7633b1efc3b1795b0972c69c3cfd7 (diff) | |
download | yelp-87fce691e3ff31d9c365147a83d9a6d50c2020e0.tar.gz |
Try to fit in a sandbox
When running in another apps sandbox, use an app name that works.
This is necessary, because we ship yelp as part of the GNOME
Flatpak runtime, and it will be launched inside another
applications sandbox to show that applications help.
-rw-r--r-- | src/yelp-application.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/yelp-application.c b/src/yelp-application.c index 92bb9dec..945b5176 100644 --- a/src/yelp-application.c +++ b/src/yelp-application.c @@ -357,12 +357,30 @@ YelpApplication * yelp_application_new (void) { YelpApplication *app; + char *app_id = NULL; + char *yelp = NULL; + + if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS)) { + GKeyFile *kf = g_key_file_new (); + g_key_file_load_from_file (kf, "/.flatpak-info", G_KEY_FILE_NONE, NULL); + if (g_key_file_has_group (kf, "Application")) + app_id = g_key_file_get_string (kf, "Application", "name", NULL); + else + app_id = g_key_file_get_string (kf, "Runtime", "name", NULL); + yelp = g_strconcat (app_id, ".Help", NULL); + g_key_file_unref (kf); + } + else { + yelp = g_strdup ("org.gnome.Yelp"); + } app = g_object_new (YELP_TYPE_APPLICATION, - "application-id", "org.gnome.Yelp", + "application-id", yelp, "flags", G_APPLICATION_HANDLES_COMMAND_LINE, "inactivity-timeout", 5000, NULL); + g_free (app_id); + g_free (yelp); return app; } |