nautilus r14107 - in branches/gnome-2-22: . libnautilus-private
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r14107 - in branches/gnome-2-22: . libnautilus-private
- Date: Sun, 27 Apr 2008 20:28:57 +0100 (BST)
Author: cosimoc
Date: Sun Apr 27 19:28:57 2008
New Revision: 14107
URL: http://svn.gnome.org/viewvc/nautilus?rev=14107&view=rev
Log:
2008-04-27 Cosimo Cecchi <cosimoc gnome org>
* libnautilus-private/nautilus-file-operations.c: (delete_files),
(trash_files), (delete_job):
Report user cancel when all the files we're about to trash or delete
are skipped in the operation. This allows to use the same selection for
requesting another deletion from the view. (#519746).
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c
Modified: branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c (original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-file-operations.c Sun Apr 27 19:28:57 2008
@@ -1461,7 +1461,7 @@
}
static void
-delete_files (CommonJob *job, GList *files)
+delete_files (CommonJob *job, GList *files, int *files_skipped)
{
GList *l;
GFile *file;
@@ -1496,6 +1496,9 @@
&skipped_file,
&source_info, &transfer_info,
TRUE);
+ if (skipped_file) {
+ (*files_skipped)++;
+ }
}
}
@@ -1525,7 +1528,7 @@
static void
-trash_files (CommonJob *job, GList *files)
+trash_files (CommonJob *job, GList *files, int *files_skipped)
{
GList *l;
GFile *file;
@@ -1553,6 +1556,7 @@
error = NULL;
if (!g_file_trash (file, job->cancellable, &error)) {
if (job->skip_all_error) {
+ (*files_skipped)++;
goto skip;
}
@@ -1576,11 +1580,13 @@
NULL);
if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) {
+ ((DeleteJob *) job)->user_cancel = TRUE;
abort_job (job);
} else if (response == 1) { /* skip all */
+ (*files_skipped)++;
job->skip_all_error = TRUE;
} else if (response == 2) { /* skip */
- /* nothing */
+ (*files_skipped)++;
} else if (response == 3) { /* delete all */
to_delete = g_list_prepend (to_delete, file);
job->delete_all = TRUE;
@@ -1602,7 +1608,7 @@
if (to_delete) {
to_delete = g_list_reverse (to_delete);
- delete_files (job, to_delete);
+ delete_files (job, to_delete, files_skipped);
g_list_free (to_delete);
}
}
@@ -1644,6 +1650,7 @@
CommonJob *common;
gboolean must_confirm_delete_in_trash;
gboolean must_confirm_delete;
+ int files_skipped;
common = (CommonJob *)job;
common->io_job = io_job;
@@ -1655,6 +1662,7 @@
must_confirm_delete_in_trash = FALSE;
must_confirm_delete = FALSE;
+ files_skipped = 0;
for (l = job->files; l != NULL; l = l->next) {
file = l->data;
@@ -1684,7 +1692,7 @@
confirmed = confirm_delete_directly (common, to_delete_files);
}
if (confirmed) {
- delete_files (common, to_delete_files);
+ delete_files (common, to_delete_files, &files_skipped);
} else {
job->user_cancel = TRUE;
}
@@ -1693,11 +1701,16 @@
if (to_trash_files != NULL) {
to_trash_files = g_list_reverse (to_trash_files);
- trash_files (common, to_trash_files);
+ trash_files (common, to_trash_files, &files_skipped);
}
g_list_free (to_trash_files);
g_list_free (to_delete_files);
+
+ if (files_skipped == g_list_length (job->files)) {
+ /* User has skipped all files, report user cancel */
+ job->user_cancel = TRUE;
+ }
g_io_scheduler_job_send_to_mainloop_async (io_job,
delete_job_done,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]