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




commit 7d29b05e4513e38c3f1cccf7b8092d7dc2ef8530
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 ed2feda10..1be9770be 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1846,7 +1846,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)
         {
@@ -2236,7 +2237,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)
         {
@@ -4146,8 +4148,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]