[gnome-builder] app: use xdg-open under flatpak
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] app: use xdg-open under flatpak
- Date: Thu, 16 Aug 2018 19:45:22 +0000 (UTC)
commit fdf83783882e7e70c40b903e21ff474e3f262a2d
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 16 12:29:07 2018 -0700
app: use xdg-open under flatpak
We need a workaround because gtk_show_uri_on_window() is not working
correctly for us, despite the portal. We're opening the URI locally which
is not what we want.
src/libide/application/ide-application-actions.c | 29 ++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/application/ide-application-actions.c
b/src/libide/application/ide-application-actions.c
index f415ff71a..cecb74633 100644
--- a/src/libide/application/ide-application-actions.c
+++ b/src/libide/application/ide-application-actions.c
@@ -34,6 +34,8 @@
#include "greeter/ide-greeter-perspective.h"
#include "keybindings/ide-shortcuts-window.h"
#include "preferences/ide-preferences-window.h"
+#include "subprocess/ide-subprocess.h"
+#include "subprocess/ide-subprocess-launcher.h"
#include "workbench/ide-workbench.h"
#include "util/ide-flatpak.h"
@@ -210,8 +212,31 @@ ide_application_actions_help_cb (GObject *object,
g_debug ("Documentation URI: %s", uri);
- if (!gtk_show_uri_on_window (focused_window, uri, gtk_get_current_event_time (), &error))
- g_warning ("Failed to load documentation: %s", error->message);
+ if (ide_is_flatpak ())
+ {
+ g_autoptr(IdeSubprocessLauncher) launcher = NULL;
+ g_autoptr(IdeSubprocess) subprocess = NULL;
+
+ /* We can't currently trust gtk_show_uri_on_window() because it tries
+ * to open our HTML page with Builder inside our current flatpak
+ * environment! We need to ensure this is fixed upstream, but it's
+ * currently unclear how to do so since we register handles for html.
+ */
+
+ launcher = ide_subprocess_launcher_new (0);
+ ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+ ide_subprocess_launcher_set_clear_env (launcher, FALSE);
+ ide_subprocess_launcher_push_argv (launcher, "xdg-open");
+ ide_subprocess_launcher_push_argv (launcher, uri);
+
+ if (!(subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error)))
+ g_warning ("Failed to spawn xdg-open for documentation: %s", error->message);
+ }
+ else
+ {
+ if (!gtk_show_uri_on_window (focused_window, uri, gtk_get_current_event_time (), &error))
+ g_warning ("Failed to load documentation: %s", error->message);
+ }
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]