mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-31 06:13:29 +02:00
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
This commit is contained in:
@@ -975,12 +975,15 @@ g_app_info_launch_default_for_uri (const char *uri,
|
|||||||
GAppLaunchContext *launch_context,
|
GAppLaunchContext *launch_context,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
if (launch_default_for_uri (uri, launch_context, error))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
if (glib_should_use_portal ())
|
if (glib_should_use_portal ())
|
||||||
return launch_default_with_portal (uri, launch_context, error);
|
return launch_default_with_portal (uri, launch_context, error);
|
||||||
else
|
|
||||||
#endif
|
#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;
|
GError *error = NULL;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
|
|
||||||
|
res = launch_default_for_uri (uri, context, &error);
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#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);
|
launch_default_with_portal_async (uri, context, cancellable, callback, user_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
res = launch_default_for_uri (uri, context, &error);
|
|
||||||
|
|
||||||
task = g_task_new (context, cancellable, callback, user_data);
|
task = g_task_new (context, cancellable, callback, user_data);
|
||||||
if (!res)
|
if (!res)
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
|
Reference in New Issue
Block a user