[sysprof] libsysprof-ui: use flatpak-spawn when necessary



commit 1d62916295d5609cc20d35e1631a23639e60b183
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 10 09:22:57 2019 -0700

    libsysprof-ui: use flatpak-spawn when necessary

 src/libsysprof-ui/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 395d739..d8bd148 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]