diff options
author | Ernestas Kulik <ernestask@src.gnome.org> | 2016-08-16 19:38:13 +0300 |
---|---|---|
committer | Ernestas Kulik <ernestask@src.gnome.org> | 2016-08-22 11:19:06 +0300 |
commit | 3f97d75e066cdcb74f889457e7c7cc178047d4e3 (patch) | |
tree | 97e02a3ffd70489b96acdf51e553cb5feddc9ef1 /src/nautilus-file-operations.c | |
parent | fe7d1c6f1dffab3bb5de90a86ccb59a04e13a7e8 (diff) | |
download | nautilus-3f97d75e066cdcb74f889457e7c7cc178047d4e3.tar.gz |
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
Diffstat (limited to 'src/nautilus-file-operations.c')
-rw-r--r-- | 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 cc2a54ed1..8cca71ba9 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); + } } } |