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

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;
...@@ -4894,26 +4895,30 @@ delete_trash_file (CommonJob *job, ...@@ -4894,26 +4895,30 @@ delete_trash_file (CommonJob *job,
if (job_aborted (job)) { if (job_aborted (job)) {
return; return;
} }
enumerator = g_file_enumerate_children (file, if (del_children) {
G_FILE_ATTRIBUTE_STANDARD_NAME, enumerator = g_file_enumerate_children (file,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_FILE_ATTRIBUTE_STANDARD_NAME ","
job->cancellable, G_FILE_ATTRIBUTE_STANDARD_TYPE,
NULL); G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
if (enumerator) { job->cancellable,
while (!job_aborted (job) && NULL);
(info = g_file_enumerator_next_file (enumerator, job->cancellable, NULL)) != NULL) { if (enumerator) {
child = g_file_get_child (file, while (!job_aborted (job) &&
g_file_info_get_name (info)); (info = g_file_enumerator_next_file (enumerator, job->cancellable, NULL)) != NULL) {
delete_trash_file (job, child, TRUE); child = g_file_get_child (file,
g_object_unref (child); g_file_info_get_name (info));
g_object_unref (info); delete_trash_file (job, child, TRUE,
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY);
g_object_unref (child);
g_object_unref (info);
}
g_file_enumerator_close (enumerator, job->cancellable, NULL);
g_object_unref (enumerator);
} }
g_file_enumerator_close (enumerator, job->cancellable, NULL); }
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