summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--thunar/thunar-io-jobs.c11
-rw-r--r--thunar/thunar-io-scan-directory.c18
-rw-r--r--thunar/thunar-io-scan-directory.h3
-rw-r--r--thunar/thunar-metafile.c2
-rw-r--r--thunar/thunar-misc-jobs.c4
-rw-r--r--thunar/thunar-transfer-job.c4
7 files changed, 30 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 8928d295..b813f4e2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
1.3.x
=====
- Fix truncated strings when loading and storing emblems (bug #7171).
+- Only erase top-level items from trash (bug #7147).
1.2.0
=====
diff --git a/thunar/thunar-io-jobs.c b/thunar/thunar-io-jobs.c
index abb662a0..898118aa 100644
--- a/thunar/thunar-io-jobs.c
+++ b/thunar/thunar-io-jobs.c
@@ -39,6 +39,7 @@
static GList *
_tij_collect_nofollow (ThunarJob *job,
GList *base_file_list,
+ gboolean unlinking,
GError **error)
{
GError *err = NULL;
@@ -54,7 +55,7 @@ _tij_collect_nofollow (ThunarJob *job,
/* try to scan the directory */
child_file_list = thunar_io_scan_directory (job, lp->data,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- TRUE, &err);
+ TRUE, unlinking, &err);
/* prepend the new files to the existing list */
file_list = thunar_g_file_list_prepend (file_list, lp->data);
@@ -386,7 +387,7 @@ _thunar_io_jobs_unlink (ThunarJob *job,
exo_job_info_message (EXO_JOB (job), _("Preparing..."));
/* recursively collect files for removal, not following any symlinks */
- file_list = _tij_collect_nofollow (job, file_list, &err);
+ file_list = _tij_collect_nofollow (job, file_list, TRUE, &err);
/* free the file list and fail if there was an error or the job was cancelled */
if (err != NULL || exo_job_is_cancelled (EXO_JOB (job)))
@@ -818,7 +819,7 @@ _thunar_io_jobs_chown (ThunarJob *job,
/* collect the files for the chown operation */
if (recursive)
- file_list = _tij_collect_nofollow (job, file_list, &err);
+ file_list = _tij_collect_nofollow (job, file_list, FALSE, &err);
else
file_list = thunar_g_file_list_copy (file_list);
@@ -965,7 +966,7 @@ _thunar_io_jobs_chmod (ThunarJob *job,
/* collect the files for the chown operation */
if (recursive)
- file_list = _tij_collect_nofollow (job, file_list, &err);
+ file_list = _tij_collect_nofollow (job, file_list, FALSE, &err);
else
file_list = thunar_g_file_list_copy (file_list);
@@ -1119,7 +1120,7 @@ _thunar_io_jobs_ls (ThunarJob *job,
/* collect directory contents (non-recursively) */
path_list = thunar_io_scan_directory (job, directory,
G_FILE_QUERY_INFO_NONE,
- FALSE, &err);
+ FALSE, FALSE, &err);
/* turn the GFile list into a ThunarFile list */
for (lp = g_list_last (path_list);
diff --git a/thunar/thunar-io-scan-directory.c b/thunar/thunar-io-scan-directory.c
index 7d0432ff..6c38733f 100644
--- a/thunar/thunar-io-scan-directory.c
+++ b/thunar/thunar-io-scan-directory.c
@@ -1,6 +1,6 @@
/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
- * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@ thunar_io_scan_directory (ThunarJob *job,
GFile *file,
GFileQueryInfoFlags flags,
gboolean recursively,
+ gboolean unlinking,
GError **error)
{
GFileEnumerator *enumerator;
@@ -56,6 +57,18 @@ thunar_io_scan_directory (ThunarJob *job,
if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
return NULL;
+ /* don't recurse when we are scanning prior to unlinking and the current
+ * file/dir is in the trash. In GVfs, only the top-level directories in
+ * the trash can be modified and deleted directly. See
+ * http://bugzilla.xfce.org/show_bug.cgi?id=7147
+ * for more information */
+ if (unlinking
+ && thunar_g_file_is_trashed (file)
+ && !thunar_g_file_is_root (file))
+ {
+ return NULL;
+ }
+
/* query the file type */
type = g_file_query_file_type (file, flags, exo_job_get_cancellable (EXO_JOB (job)));
@@ -96,7 +109,8 @@ thunar_io_scan_directory (ThunarJob *job,
/* if the child is a directory and we need to recurse ... just do so */
if (recursively && g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
{
- child_files = thunar_io_scan_directory (job, child_file, flags, recursively, &err);
+ child_files = thunar_io_scan_directory (job, child_file, flags, recursively,
+ unlinking, &err);
/* prepend children to the file list to make sure they're
* processed first (required for unlinking) */
diff --git a/thunar/thunar-io-scan-directory.h b/thunar/thunar-io-scan-directory.h
index f654e682..1ace9750 100644
--- a/thunar/thunar-io-scan-directory.h
+++ b/thunar/thunar-io-scan-directory.h
@@ -1,6 +1,6 @@
/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
- * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@ GList *thunar_io_scan_directory (ThunarJob *job,
GFile *file,
GFileQueryInfoFlags flags,
gboolean recursively,
+ gboolean unlinking,
GError **error);
G_END_DECLS
diff --git a/thunar/thunar-metafile.c b/thunar/thunar-metafile.c
index 42212960..03be9179 100644
--- a/thunar/thunar-metafile.c
+++ b/thunar/thunar-metafile.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*-
* Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org>
- * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/thunar/thunar-misc-jobs.c b/thunar/thunar-misc-jobs.c
index 9005cefc..a5418035 100644
--- a/thunar/thunar-misc-jobs.c
+++ b/thunar/thunar-misc-jobs.c
@@ -1,6 +1,6 @@
/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
- * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ _thunar_misc_jobs_load_templates (ThunarJob *job,
{
paths = thunar_io_scan_directory (job, templates_dir,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- TRUE, NULL);
+ TRUE, FALSE, NULL);
/* turn the GFile list into a ThunarFile list */
for (lp = g_list_last (paths);
diff --git a/thunar/thunar-transfer-job.c b/thunar/thunar-transfer-job.c
index 8e3d0eac..364bd4ec 100644
--- a/thunar/thunar-transfer-job.c
+++ b/thunar/thunar-transfer-job.c
@@ -1,7 +1,7 @@
/* vi:set sw=2 sts=2 ts=2 et ai: */
/*-
* Copyright (c) 2005-2007 Benedikt Meurer <benny@xfce.org>
- * Copyright (c) 2009 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2009-2011 Jannis Pohlmann <jannis@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -195,7 +195,7 @@ thunar_transfer_job_collect_node (ThunarTransferJob *job,
/* scan the directory for immediate children */
file_list = thunar_io_scan_directory (THUNAR_JOB (job), node->source_file,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- FALSE, &err);
+ FALSE, FALSE, &err);
/* add children to the transfer node */
for (lp = file_list; err == NULL && lp != NULL; lp = lp->next)