Blame SOURCES/0003-open-uri-Always-open-URIs-in-default-app.patch

e90b52
From a82f40b933f1918e7b7c30830b54e713860b8494 Mon Sep 17 00:00:00 2001
e90b52
From: Bastien Nocera <hadess@hadess.net>
e90b52
Date: Thu, 16 Apr 2020 16:38:47 +0200
e90b52
Subject: [PATCH 3/5] open-uri: Always open URIs in default app
e90b52
e90b52
Always open URIs and directories in the default application, as both
e90b52
GNOME and KDE have Settings allowing those to be changed easily.
e90b52
e90b52
(cherry picked from commit 1dbdd31a8f4d4bb5808e85e46bf8fe8443290159)
e90b52
---
e90b52
 src/open-uri.c | 19 ++++++++++---------
e90b52
 1 file changed, 10 insertions(+), 9 deletions(-)
e90b52
e90b52
diff --git a/src/open-uri.c b/src/open-uri.c
e90b52
index 35ba644..21b180e 100644
e90b52
--- a/src/open-uri.c
e90b52
+++ b/src/open-uri.c
e90b52
@@ -445,8 +445,8 @@ get_content_type_for_file (const char  *path,
e90b52
 }
e90b52
 
e90b52
 static gboolean
e90b52
-can_skip_app_chooser (const char *scheme,
e90b52
-                      const char *content_type)
e90b52
+should_use_default_app (const char *scheme,
e90b52
+                        const char *content_type)
e90b52
 {
e90b52
   const char *skipped_schemes[] = {
e90b52
     "http",
e90b52
@@ -562,7 +562,7 @@ handle_open_in_thread_func (GTask *task,
e90b52
   gboolean writable = FALSE;
e90b52
   gboolean ask = FALSE;
e90b52
   gboolean open_dir = FALSE;
e90b52
-  gboolean can_skip = FALSE;
e90b52
+  gboolean use_default_app = FALSE;
e90b52
   const char *reason;
e90b52
 
e90b52
   parent_window = (const char *)g_object_get_data (G_OBJECT (request), "parent-window");
e90b52
@@ -632,7 +632,7 @@ handle_open_in_thread_func (GTask *task,
e90b52
 
e90b52
   /* collect all the information */
e90b52
   find_recommended_choices (scheme, content_type, &default_app, &choices, &n_choices);
e90b52
-  can_skip = can_skip_app_chooser (scheme, content_type);
e90b52
+  use_default_app = should_use_default_app (scheme, content_type);
e90b52
   get_latest_choice_info (app_id, content_type,
e90b52
                           &latest_id, &latest_count, &latest_threshold,
e90b52
                           &ask_for_content_type);
e90b52
@@ -640,11 +640,10 @@ handle_open_in_thread_func (GTask *task,
e90b52
   skip_app_chooser = FALSE;
e90b52
   reason = NULL;
e90b52
 
e90b52
-  /* apply default handling: skip if the we have a default handler and its http or inode/directory */
e90b52
-  if (default_app != NULL && can_skip)
e90b52
+  /* apply default handling: skip if the we have a default handler */
e90b52
+  if (default_app != NULL && use_default_app)
e90b52
     {
e90b52
-      if (!skip_app_chooser)
e90b52
-        reason = "Allowing to skip app chooser: can use default";
e90b52
+      reason = "Allowing to skip app chooser: can use default";
e90b52
       skip_app_chooser = TRUE;
e90b52
     }
e90b52
 
e90b52
@@ -685,7 +684,9 @@ handle_open_in_thread_func (GTask *task,
e90b52
     {
e90b52
       const char *app;
e90b52
 
e90b52
-      if (latest_id != NULL)
e90b52
+      if (default_app != NULL && use_default_app)
e90b52
+        app = default_app;
e90b52
+      else if (latest_id != NULL)
e90b52
         app = latest_id;
e90b52
       else if (default_app != NULL)
e90b52
         app = default_app;
e90b52
-- 
e90b52
2.26.2
e90b52