summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-11-23 23:39:10 +0100
committerraveit65 <[email protected]>2022-07-21 19:33:49 +0200
commit94cdc752d0030e828241ace821e7d303bb35ac58 (patch)
tree460cc9fcaf82ec2d3a762c765dee81a0ebc84ff4
parentf7d45480798b69ec4b115a44b5831bcd28a34846 (diff)
downloadcaja-94cdc752d0030e828241ace821e7d303bb35ac58.tar.bz2
caja-94cdc752d0030e828241ace821e7d303bb35ac58.tar.xz
caja-directory-async: trust also launchers from user desktop
-rw-r--r--libcaja-private/caja-directory-async.c11
-rw-r--r--libcaja-private/caja-file-utilities.c25
-rw-r--r--libcaja-private/caja-file-utilities.h3
3 files changed, 31 insertions, 8 deletions
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
index 718f7809..cd02177c 100644
--- a/libcaja-private/caja-directory-async.c
+++ b/libcaja-private/caja-directory-async.c
@@ -3854,25 +3854,22 @@ static gboolean
is_link_trusted (CajaFile *file,
gboolean is_launcher)
{
- gboolean res;
+ gboolean res = FALSE;
if (!is_launcher)
{
return TRUE;
}
- res = FALSE;
-
if (caja_file_can_execute (file) && caja_file_is_local (file))
{
GFile *location;
location = caja_file_get_location (file);
- res = caja_is_in_system_dir (location);
- if (!res) {
- res = is_trusted_system_desktop_file (location);
- }
+ res = caja_is_in_system_dir (location) ||
+ is_trusted_system_desktop_file (location) ||
+ caja_is_in_desktop_dir (location);
g_object_unref (location);
}
diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c
index 424cf421..2dae9794 100644
--- a/libcaja-private/caja-file-utilities.c
+++ b/libcaja-private/caja-file-utilities.c
@@ -1134,6 +1134,31 @@ caja_is_in_system_dir (GFile *file)
return res;
}
+gboolean
+caja_is_in_desktop_dir (GFile *file)
+{
+ char *path;
+ char *dirname;
+ gboolean res = FALSE;
+
+ if (!g_file_is_native (file))
+ {
+ return res;
+ }
+
+ path = g_file_get_path (file);
+ dirname = g_path_get_dirname (path);
+ if (g_strcmp0 (dirname, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
+ {
+ res = TRUE;
+ }
+
+ g_free (path);
+ g_free (dirname);
+
+ return res;
+}
+
GHashTable *
caja_trashed_files_get_original_directories (GList *files,
GList **unhandled_files)
diff --git a/libcaja-private/caja-file-utilities.h b/libcaja-private/caja-file-utilities.h
index 2306601f..1a65fcb9 100644
--- a/libcaja-private/caja-file-utilities.h
+++ b/libcaja-private/caja-file-utilities.h
@@ -48,7 +48,8 @@ gboolean caja_is_home_directory (GFile *dir);
gboolean caja_is_home_directory_file (GFile *dir,
const char *filename);
GMount * caja_get_mounted_mount_for_root (GFile *location);
-gboolean caja_is_in_system_dir (GFile *location);
+gboolean caja_is_in_desktop_dir (GFile *file);
+gboolean caja_is_in_system_dir (GFile *file);
char * caja_get_pixmap_directory (void);
gboolean caja_should_use_templates_directory (void);