[glib/glib-2-52] appinfo: Only use portal as fallback



commit 6d05094462c6494a3adaa78688ea0c102df08c6b
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 5c4baa2..c64b688 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -892,12 +892,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;
 }
 
 /**
@@ -928,16 +931,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]