[nautilus/wip/oholy/progress-fixes: 1/2] file-operations: Do not report remaining time if not yet computed




commit 8a867be57018724d84d3c8163330ebdaf9ce2414
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Oct 5 14:34:45 2020 +0200

    file-operations: Do not report remaining time if not yet computed
    
    Currently, the remaining time for some operations is reported even if
    it hasn't been yet computed. Consequently, "596,523 hours left" is
    shown to the user as it corresponds to the initial value, which is INT_MAX.
    In most cases this is because some GVfs backend doesn't report progress
    except the total file size. Let's do not report remaining time if transfer
    rate is 0, ie. remaing time is not computed.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/232

 src/nautilus-file-operations.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 3adf3b54c..690c286a2 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1830,7 +1830,8 @@ report_delete_progress (CommonJob    *job,
         }
     }
 
-    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE)
+    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE ||
+        transfer_rate == 0)
     {
         if (files_left > 0)
         {
@@ -2220,7 +2221,8 @@ report_trash_progress (CommonJob    *job,
         }
     }
 
-    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE)
+    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE ||
+        transfer_rate == 0)
     {
         if (files_left > 0)
         {
@@ -4063,8 +4065,8 @@ report_copy_progress (CopyMoveJob  *copy_job,
         }
     }
 
-    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE &&
-        transfer_rate > 0)
+    if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE ||
+        transfer_rate == 0)
     {
         if (source_info->num_files == 1)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]