Commit b86f10bf authored by Christian Hergert's avatar Christian Hergert

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.

# Conflicts:
#	src/libide/application/ide-application-actions.c
parent 24152b1c
......@@ -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"
......@@ -205,8 +207,35 @@ ide_application_actions_help_cb (GObject *object,
uri = g_strdup_printf ("file://%s/en/index.html", file_base);
if (!gtk_show_uri_on_window (focused_window, uri, gtk_get_current_event_time (), &error))
g_warning ("Failed to load documentation: %s", error->message);
g_debug ("Documentation URI: %s", uri);
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;
}
IDE_EXIT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment