Commit 36af435b authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson
Browse files

Don't follow symlinks when emptying trash (#513912)

2008-02-04  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-file-operations.c:
	Don't follow symlinks when emptying trash (#513912)



svn path=/trunk/; revision=13689
parent 062e2b95
2008-02-04 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c:
Don't follow symlinks when emptying trash (#513912)
2008-02-01 Alexander Larsson <alexl@redhat.com> 2008-02-01 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-mime-actions.c: * libnautilus-private/nautilus-mime-actions.c:
......
...@@ -4885,7 +4885,8 @@ nautilus_file_operations_new_file (GtkWidget *parent_view, ...@@ -4885,7 +4885,8 @@ nautilus_file_operations_new_file (GtkWidget *parent_view,
static void static void
delete_trash_file (CommonJob *job, delete_trash_file (CommonJob *job,
GFile *file, GFile *file,
gboolean del_dir) gboolean del_file,
gboolean del_children)
{ {
GFileInfo *info; GFileInfo *info;
GFile *child; GFile *child;
...@@ -4895,8 +4896,10 @@ delete_trash_file (CommonJob *job, ...@@ -4895,8 +4896,10 @@ delete_trash_file (CommonJob *job,
return; return;
} }
if (del_children) {
enumerator = g_file_enumerate_children (file, enumerator = g_file_enumerate_children (file,
G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
job->cancellable, job->cancellable,
NULL); NULL);
...@@ -4905,15 +4908,17 @@ delete_trash_file (CommonJob *job, ...@@ -4905,15 +4908,17 @@ delete_trash_file (CommonJob *job,
(info = g_file_enumerator_next_file (enumerator, job->cancellable, NULL)) != NULL) { (info = g_file_enumerator_next_file (enumerator, job->cancellable, NULL)) != NULL) {
child = g_file_get_child (file, child = g_file_get_child (file,
g_file_info_get_name (info)); g_file_info_get_name (info));
delete_trash_file (job, child, TRUE); delete_trash_file (job, child, TRUE,
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
g_object_unref (child); g_object_unref (child);
g_object_unref (info); g_object_unref (info);
} }
g_file_enumerator_close (enumerator, job->cancellable, NULL); g_file_enumerator_close (enumerator, job->cancellable, NULL);
g_object_unref (enumerator); g_object_unref (enumerator);
} }
}
if (!job_aborted (job) && del_dir) { if (!job_aborted (job) && del_file) {
g_file_delete (file, job->cancellable, NULL); g_file_delete (file, job->cancellable, NULL);
} }
} }
...@@ -4952,7 +4957,7 @@ empty_trash_job (GIOSchedulerJob *io_job, ...@@ -4952,7 +4957,7 @@ empty_trash_job (GIOSchedulerJob *io_job,
for (l = job->trash_dirs; for (l = job->trash_dirs;
l != NULL && !job_aborted (common); l != NULL && !job_aborted (common);
l = l->next) { l = l->next) {
delete_trash_file (common, l->data, FALSE); delete_trash_file (common, l->data, FALSE, TRUE);
} }
g_io_scheduler_job_send_to_mainloop_async (io_job, g_io_scheduler_job_send_to_mainloop_async (io_job,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment