1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
|