[yelp] Try to fit in a sandbox
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Try to fit in a sandbox
- Date: Wed, 23 Jan 2019 16:50:17 +0000 (UTC)
commit 87fce691e3ff31d9c365147a83d9a6d50c2020e0
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 16 15:44:48 2017 -0400
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.
src/yelp-application.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
---
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]