[glib] appinfo: Only use portal as fallback
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] appinfo: Only use portal as fallback
- Date: Sat, 25 Mar 2017 21:45:01 +0000 (UTC)
commit 05f0d8199b3774de5b9dd8df80e0cb8ce1a9421f
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Mar 19 22:33:56 2017 +0100
appinfo: Only use portal as fallback
We currently assume that the OpenURI portal should be used
unconditionally when running inside a flatpak sandbox. While
the portal is what we usually want, there are exceptions:
Yelp is now included in the GNOME runtime to allow displaying
help without exporting the user documentation, and the sandboxed
app itself may register a scheme handler.
To account for those cases transparently, always try the normal
code path first and only fall back to calling the portal when
that fails.
https://bugzilla.gnome.org/show_bug.cgi?id=780471
gio/gappinfo.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index 1dde48d..30501fd 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -975,12 +975,15 @@ g_app_info_launch_default_for_uri (const char *uri,
GAppLaunchContext *launch_context,
GError **error)
{
+ if (launch_default_for_uri (uri, launch_context, error))
+ return TRUE;
+
#ifdef G_OS_UNIX
if (glib_should_use_portal ())
return launch_default_with_portal (uri, launch_context, error);
- else
#endif
- return launch_default_for_uri (uri, launch_context, error);
+
+ return FALSE;
}
/**
@@ -1011,16 +1014,16 @@ g_app_info_launch_default_for_uri_async (const char *uri,
GError *error = NULL;
GTask *task;
+ res = launch_default_for_uri (uri, context, &error);
+
#ifdef G_OS_UNIX
- if (glib_should_use_portal ())
+ if (!res && glib_should_use_portal ())
{
launch_default_with_portal_async (uri, context, cancellable, callback, user_data);
return;
}
#endif
- res = launch_default_for_uri (uri, context, &error);
-
task = g_task_new (context, cancellable, callback, user_data);
if (!res)
g_task_return_error (task, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]