Roland Illig wrote: > Hampa Hug wrote: > > If a file is moved by copy/remove the progress bar is advanced twice. On > > the other hand, if a file is moved by renaming the progress bar is never > > updated. The attached patch fixes this. > > Thanks for identifying and fixing this long-known bug. Before committing > the patch, I have one question left. > > > diff -ur mc-cvs/src/file.c mc-dev/src/file.c > > --- mc-cvs/src/file.c 2006-04-25 05:05:17.000000000 +0200 > > +++ mc-dev/src/file.c 2006-05-03 07:09:36.000000000 +0200 > > @@ -1022,6 +1022,7 @@ > > { > > struct stat src_stats, dst_stats; > > int return_status = FILE_CONT; > > + int copy = 0; > > This variable looks like it should be of type gboolean. I also find its > name too generic; maybe copy_done would be more appropriate?
I made a new patch with those two changes. Hampa
diff -ur mc-cvs/src/file.c mc-dev/src/file.c --- mc-cvs/src/file.c 2006-04-25 05:05:17.000000000 +0200 +++ mc-dev/src/file.c 2006-05-21 12:35:20.000000000 +0200 @@ -1022,6 +1022,7 @@ { struct stat src_stats, dst_stats; int return_status = FILE_CONT; + gboolean copy_done = FALSE; if (file_progress_show_source (ctx, s) == FILE_ABORT || file_progress_show_target (ctx, d) == FILE_ABORT) @@ -1080,7 +1081,9 @@ } if (mc_rename (s, d) == 0) { - return FILE_CONT; + return progress_update_one (ctx, progress_count, + progress_bytes, + src_stats.st_size, 1); } } #if 0 @@ -1107,6 +1110,8 @@ if (return_status != FILE_CONT) return return_status; + copy_done = TRUE; + if ((return_status = file_progress_show_source (ctx, NULL)) != FILE_CONT || (return_status = file_progress_show (ctx, 0, 0)) != FILE_CONT) @@ -1123,11 +1128,12 @@ return return_status; } - if (return_status == FILE_CONT) + if (!copy_done) { return_status = progress_update_one (ctx, progress_count, progress_bytes, src_stats.st_size, 1); + } return return_status; }
_______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel