[gvfs/wip/oholy/smb-move-progress] smb: Report progress when move operation is done




commit 2810870bfed084b1e438a7a8f5cf2d11a00c8950
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Oct 19 12:38:21 2020 +0200

    smb: Report progress when move operation is done
    
    The move operation doesn't report progress currently, however, the
    documentation says that it is guaranteed that the prorgress_callback
    is called after all data has been transferred. Let's report the
    the total number of bytes moved during the operation.
    
    https://gitlab.gnome.org/GNOME/nautilus/-/issues/1635

 daemon/gvfsbackendsmb.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 01b1de79..321e9c2b 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -49,6 +49,7 @@
 #include "gvfsjobqueryfsinfo.h"
 #include "gvfsjobqueryattributes.h"
 #include "gvfsjobenumerate.h"
+#include "gvfsjobmove.h"
 #include "gvfsdaemonprotocol.h"
 #include "gvfsdaemonutils.h"
 #include "gvfsutils.h"
@@ -2041,6 +2042,7 @@ do_move (GVfsBackend *backend,
   smbc_stat_fn smbc_stat;
   smbc_rename_fn smbc_rename;
   smbc_unlink_fn smbc_unlink;
+  goffset size;
 
   
   source_uri = create_smb_uri (op_backend->server, op_backend->port, op_backend->share, source);
@@ -2062,8 +2064,9 @@ do_move (GVfsBackend *backend,
       g_free (source_uri);
       return;
     }
-  else
-    source_is_dir = S_ISDIR (statbuf.st_mode);
+
+  source_is_dir = S_ISDIR (statbuf.st_mode);
+  size = statbuf.st_size;
 
   dest_uri = create_smb_uri (op_backend->server, op_backend->port, op_backend->share, destination);
   
@@ -2158,7 +2161,10 @@ do_move (GVfsBackend *backend,
        g_vfs_job_failed_from_errno (G_VFS_JOB (job), errsv);
     }
   else
-    g_vfs_job_succeeded (G_VFS_JOB (job));
+    {
+      g_vfs_job_progress_callback (size, size, job);
+      g_vfs_job_succeeded (G_VFS_JOB (job));
+    }
 }
 
 static void


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