[PATCH] Improve GnomeVFS XFer code (was: Re: [PATCH] Improve Nautilus XFer code)



Am Mittwoch, den 11.01.2006, 15:38 +0100 schrieb Alexander Larsson:
> The async callback is used for slower, ui handling. Its where you
> handle
> errors, and progress updates. Its *always* called on errors or other
> "must be handled by user" cases (name conflicts, etc), but its only
> periodically called when it comes to "normal" progress so that you can
> update a progress bar without slowing down the app to a crawl.

OK, now I grasp it. The attached patch makes GnomeVFS force the call to
the async callback whenever the value is not just interpreted as bool
but does form some kind of decision possibly done by the user.

-- 
Christian Neumair <chris gnome-de org>
Index: libgnomevfs/gnome-vfs-xfer.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-xfer.c,v
retrieving revision 1.130
diff -u -p -r1.130 gnome-vfs-xfer.c
--- libgnomevfs/gnome-vfs-xfer.c	26 Nov 2005 13:39:51 -0000	1.130
+++ libgnomevfs/gnome-vfs-xfer.c	11 Jan 2006 17:30:19 -0000
@@ -409,9 +406,9 @@ remove_file (GnomeVFSURI *uri,
 			 */
 			progress->progress_info->total_bytes_copied += DEFAULT_SIZE_OVERHEAD;
 
-			if (call_progress_with_uris_often (progress, uri, NULL, 
-							   GNOME_VFS_XFER_PHASE_DELETESOURCE) 
-				== GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
+			if (call_progress_with_uris (progress, uri, NULL, 
+						     GNOME_VFS_XFER_PHASE_DELETESOURCE) 
+			    == GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
 				result = GNOME_VFS_ERROR_INTERRUPTED;
 				break;
 			}
@@ -618,8 +615,8 @@ remove_directory (GnomeVFSURI *uri,
 				/* add some small size for each deleted item */
 				progress->progress_info->total_bytes_copied += DEFAULT_SIZE_OVERHEAD;
 
-				if (call_progress_with_uris_often (progress, uri, NULL, 
-					GNOME_VFS_XFER_PHASE_DELETESOURCE) 
+				if (call_progress_with_uris (progress, uri, NULL,
+							     GNOME_VFS_XFER_PHASE_DELETESOURCE) 
 					== GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
 					result = GNOME_VFS_ERROR_INTERRUPTED;
 					break;
@@ -1479,8 +1476,9 @@ copy_file (GnomeVFSFileInfo *info,  
 		return result;
 	}
 
-	if (call_progress_with_uris_often (progress, source_uri, target_uri, 
-		GNOME_VFS_XFER_PHASE_OPENTARGET) != GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
+	if (call_progress_with_uris (progress, source_uri, target_uri, 
+				     GNOME_VFS_XFER_PHASE_OPENTARGET)
+	    != GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
 
 		result = copy_file_data (target_handle, source_handle,
 					 progress, xfer_options, error_mode,
@@ -1563,9 +1561,9 @@ copy_directory (GnomeVFSFileInfo *source
 	}
 
 	progress->progress_info->bytes_copied = 0;
-	if (call_progress_with_uris_often (progress, source_dir_uri, target_dir_uri, 
-			       GNOME_VFS_XFER_PHASE_COPYING) 
-		== GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
+	if (call_progress_with_uris (progress, source_dir_uri, target_dir_uri, 
+				     GNOME_VFS_XFER_PHASE_COPYING) 
+	    == GNOME_VFS_XFER_OVERWRITE_ACTION_ABORT) {
 		return GNOME_VFS_ERROR_INTERRUPTED;
 	}
 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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