display total sector info in copy_filesystem()

* src/GParted_Core.cc: display total sector info in copy_filesystem()
This commit is contained in:
Bart Hakvoort 2006-09-10 20:48:07 +00:00
parent 801befe92f
commit 50a32c3e14
2 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2006-09-10 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: display total sector info in copy_filesystem()
2006-09-10 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-09-10 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Dialog_Progress.cc: make sure progressfraction stays between 0.0 * src/Dialog_Progress.cc: make sure progressfraction stays between 0.0

View File

@ -1566,7 +1566,6 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
OperationDetail & operationdetail, OperationDetail & operationdetail,
Sector & total_done ) Sector & total_done )
{ {
total_done = 0 ;
return copy_filesystem( partition_src .device_path, return copy_filesystem( partition_src .device_path,
partition_dst .device_path, partition_dst .device_path,
partition_src .sector_start, partition_src .sector_start,
@ -1587,7 +1586,8 @@ bool GParted_Core::copy_filesystem( const Glib::ustring & src_device,
Sector & total_done ) Sector & total_done )
{ {
operationdetail .add_child( OperationDetail( _("using internal algorithm"), STATUS_NONE ) ) ; operationdetail .add_child( OperationDetail( _("using internal algorithm"), STATUS_NONE ) ) ;
//FIXME: consider displaying length here and total_done in the end... operationdetail .add_child( OperationDetail( String::ucompose( _("copy %1 sectors"), length ), STATUS_NONE ) ) ;
operationdetail .add_child( OperationDetail( _("finding optimal blocksize"), STATUS_NONE ) ) ; operationdetail .add_child( OperationDetail( _("finding optimal blocksize"), STATUS_NONE ) ) ;
Sector optimal_blocksize = readonly ? 128 : 64, N = 32768 ; Sector optimal_blocksize = readonly ? 128 : 64, N = 32768 ;
@ -1600,6 +1600,7 @@ bool GParted_Core::copy_filesystem( const Glib::ustring & src_device,
offset_write += (length -N) ; offset_write += (length -N) ;
} }
total_done = 0 ;
Sector done = 0 ; Sector done = 0 ;
Glib::Timer timer ; Glib::Timer timer ;
double smallest_time = 1000000 ; double smallest_time = 1000000 ;
@ -1646,16 +1647,19 @@ bool GParted_Core::copy_filesystem( const Glib::ustring & src_device,
Utils::format_size( optimal_blocksize ) ), Utils::format_size( optimal_blocksize ) ),
STATUS_NONE ) ) ; STATUS_NONE ) ) ;
return succes && if ( succes )
copy_blocks( src_device, succes = copy_blocks( src_device,
dst_device, dst_device,
src_start + ( dst_start > src_start ? 0 : done ), src_start + ( dst_start > src_start ? 0 : done ),
dst_start + ( dst_start > src_start ? 0 : done ), dst_start + ( dst_start > src_start ? 0 : done ),
length - std::abs( done ), length - std::abs( done ),
optimal_blocksize, optimal_blocksize,
operationdetail, operationdetail,
readonly, readonly,
total_done ) ; total_done ) ;
operationdetail .add_child( OperationDetail( String::ucompose( _("%1 sectors copied"), total_done ), STATUS_NONE ) ) ;
return succes ;
} }
void GParted_Core::rollback_transaction( const Partition & partition_src, void GParted_Core::rollback_transaction( const Partition & partition_src,