summaryrefslogtreecommitdiffstats
path: root/debian/patches/mime-actions-Check-flatpak-info-only-once.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/mime-actions-Check-flatpak-info-only-once.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/debian/patches/mime-actions-Check-flatpak-info-only-once.patch b/debian/patches/mime-actions-Check-flatpak-info-only-once.patch
new file mode 100644
index 0000000..b0204d5
--- /dev/null
+++ b/debian/patches/mime-actions-Check-flatpak-info-only-once.patch
@@ -0,0 +1,62 @@
+From: =?utf-8?q?Ant=C3=B3nio_Fernandes?= <antoniof@gnome.org>
+Date: Wed, 30 Dec 2020 16:53:27 +0000
+Subject: mime-actions: Check flatpak-info only once
+
+Origin: upstream, 40.rc, commit:f3ef2e812e567d5252d5b5a1242a5d1390556dba
+---
+ src/nautilus-mime-actions.c | 21 ++++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
+index cbff2fa..46188ad 100644
+--- a/src/nautilus-mime-actions.c
++++ b/src/nautilus-mime-actions.c
+@@ -250,6 +250,20 @@ static void activate_callback (GList *files,
+ gpointer callback_data);
+ static void activation_mount_not_mounted (ActivateParameters *parameters);
+
++static gboolean
++is_sandboxed (void)
++{
++ static gboolean ret;
++
++ static gsize init = 0;
++ if (g_once_init_enter (&init))
++ {
++ ret = g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
++ g_once_init_leave (&init, 1);
++ }
++
++ return ret;
++}
+
+ static void
+ launch_location_free (LaunchLocation *location)
+@@ -1499,16 +1513,14 @@ launch_default_for_uris_callback (GObject *source_object,
+ ApplicationLaunchAsyncParameters *params;
+ ActivateParameters *activation_params;
+ char *uri;
+- gboolean sandboxed;
+ GError *error = NULL;
+
+ params = user_data;
+ activation_params = params->activation_params;
+ uri = g_queue_pop_head (params->uris);
+- sandboxed = g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
+
+ nautilus_launch_default_for_uri_finish (res, &error);
+- if (!sandboxed && error != NULL && error->code != G_IO_ERROR_CANCELLED)
++ if (!is_sandboxed () && error != NULL && error->code != G_IO_ERROR_CANCELLED)
+ {
+ g_queue_push_tail (params->unhandled_uris, uri);
+ }
+@@ -1741,8 +1753,7 @@ activate_files (ActivateParameters *parameters)
+ }
+ }
+
+- if (!g_queue_is_empty (open_in_app_uris) &&
+- g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS))
++ if (!g_queue_is_empty (open_in_app_uris) && is_sandboxed ())
+ {
+ const char *uri;
+ ApplicationLaunchAsyncParameters *async_params;