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




commit b6f22a50ec14436688600523af6f7c1b04700aec
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 9b721dd71..5b10c9e03 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -1849,7 +1849,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)
         {
@@ -2239,7 +2240,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)
         {
@@ -4149,8 +4151,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]