[nautilus] file-operations: update progress on skip
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file-operations: update progress on skip
- Date: Mon, 22 Aug 2016 08:19:15 +0000 (UTC)
commit 3f97d75e066cdcb74f889457e7c7cc178047d4e3
Author: Ernestas Kulik <ernestask src gnome org>
Date: Tue Aug 16 19:38:13 2016 +0300
file-operations: update progress on skip
Currently, the transfer info of an operation is only modified if it is
successful, resulting in a confusing reflection in the UI. Treating
skipped operations as completed and displaying them as such feels more
natural, as they are technically completed (i.e. nothing has been done).
This commit changes the behavior as such.
https://bugzilla.gnome.org/show_bug.cgi?id=769383
src/nautilus-file-operations.c | 42 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index cc2a54e..8cca71b 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -2012,6 +2012,29 @@ skip:
}
static void
+transfer_add_file_to_count (GFile *file,
+ CommonJob *job,
+ TransferInfo *transfer_info)
+{
+ g_autoptr (GFileInfo) file_info;
+
+ if (g_cancellable_is_cancelled (job->cancellable)) {
+ return;
+ }
+
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ job->cancellable,
+ NULL);
+
+ transfer_info->num_files++;
+ if (file_info != NULL) {
+ transfer_info->num_bytes += g_file_info_get_size (file_info);
+ }
+}
+
+static void
trash_files (CommonJob *job,
GList *files,
int *files_skipped)
@@ -2053,6 +2076,9 @@ trash_files (CommonJob *job,
TRUE, &to_delete);
if (skipped_file) {
(*files_skipped)++;
+ transfer_file_add_to_count (file, job, &transfer_info);
+ report_trash_progress (job, &source_info, &transfer_info);
+
}
}
@@ -3927,6 +3953,12 @@ copy_move_directory (CopyMoveJob *copy_job,
copy_move_file (copy_job, src_file, *dest, same_fs, FALSE, &dest_fs_type,
source_info, transfer_info, NULL, NULL, FALSE, &local_skipped_file,
readonly_source_fs);
+
+ if (local_skipped_file) {
+ transfer_file_add_to_count (src_file, job, transfer_info);
+ report_copy_progress (copy_job, source_info, transfer_info);
+ }
+
g_object_unref (src_file);
g_object_unref (info);
}
@@ -4889,6 +4921,11 @@ copy_files (CopyMoveJob *job,
point, FALSE, &skipped_file,
readonly_source_fs);
g_object_unref (dest);
+
+ if (skipped_file) {
+ transfer_file_add_to_count (src, common, transfer_info);
+ report_copy_progress (job, source_info, transfer_info);
+ }
}
i++;
}
@@ -5458,6 +5495,11 @@ common = &job->common;
job->debuting_files,
point, fallback->overwrite, &skipped_file, FALSE);
i++;
+
+ if (skipped_file) {
+ transfer_file_add_to_count (src, common, transfer_info);
+ report_copy_progress (job, source_info, transfer_info);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]