diff options
author | Sachin Daluja <30343-sachindaluja@users.noreply.gitlab.gnome.org> | 2020-12-31 00:51:33 -0500 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-01-17 21:55:18 +0000 |
commit | 1bab20c7422dd5af08b0a2de6aa25363b8da3403 (patch) | |
tree | ce5df9424b15ca24b3452e6a014e3078d71fd334 | |
parent | 11c136694829e695e511ec6a2b0fdbcffccf65a0 (diff) | |
download | nautilus-1bab20c7422dd5af08b0a2de6aa25363b8da3403.tar.gz |
file-operations: Fix transfered count for directories
The size of a copied or moved directory (when represented as a file itself - in
addition to its contents) was not being included in the transferred byte count.
Add code to include size of directory in transferred byte count.
Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1501
-rw-r--r-- | src/nautilus-file-operations.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index 173525842..ed2feda10 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -5007,6 +5007,22 @@ retry: /* Count the copied directory as a file */ transfer_info->num_files++; + + info = g_file_query_info (src, + G_FILE_ATTRIBUTE_STANDARD_SIZE, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + job->cancellable, + NULL); + + g_warn_if_fail (info != NULL); + + if (info != NULL) + { + transfer_info->num_bytes += g_file_info_get_size (info); + + g_object_unref (info); + } + report_copy_progress (copy_job, source_info, transfer_info); if (debuting_files) |