From 1d62916295d5609cc20d35e1631a23639e60b183 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 10 May 2019 09:22:57 -0700 Subject: [PATCH] libsysprof-ui: use flatpak-spawn when necessary --- .../sysprof-profiler-menu-button.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-profiler-menu-button.c b/src/libsysprof-ui/sysprof-profiler-menu-button.c index 395d7391..d8bd148c 100644 --- a/src/libsysprof-ui/sysprof-profiler-menu-button.c +++ b/src/libsysprof-ui/sysprof-profiler-menu-button.c @@ -820,7 +820,22 @@ sysprof_profiler_menu_button_validate_spawn (SysprofProfilerMenuButton *self, } else { - sysprof_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv); + g_autoptr(GPtrArray) cooked = g_ptr_array_new (); + + if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS)) + { + g_ptr_array_add (cooked, "flatpak-spawn"); + g_ptr_array_add (cooked, "--host"); + g_ptr_array_add (cooked, "--watch-bus"); + } + + for (guint i = 0; argv[i] != NULL; i++) + g_ptr_array_add (cooked, argv[i]); + g_ptr_array_add (cooked, NULL); + + sysprof_profiler_set_spawn_argv (priv->profiler, + (const gchar * const *)cooked->pdata); + g_object_set (entry, "secondary-icon-name", NULL, "secondary-icon-tooltip-text", NULL,