summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private')
-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 b50c168e..874667d3 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 84198bfa..0049514f 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);