Add libparted ped_file_system_resize thread to avoid blocking GUI (#737022)

Since GParted commit 52a2a9b "Reduce threading (#685740)", released in
GParted 0.15.0, application of operations occurs in the main thread
running the UI, therefore long running libparted actions such as
resizing a FAT16 or FAT32 file system hang the UI for as long as it take
to complete the operation.
https://git.gnome.org/browse/gparted/commit/?id=52a2a9b00a32996921ace055e71d0e09fb33c5fe

Though this problem exists for all libparted actions, it is particularly
noticeable when performing a large resize of fat16/fat32/hfs/hfs+ file
systems.

To address this significant cause of an unresponsive GUI, this
enhancement adds threading to the libparted ped_file_system_resize
function call.

Bug 737022 - UI hangs while running libparted operations such as
             FAT16/FAT32 resizing
This commit is contained in:
Curtis Gedak 2015-07-14 13:40:56 -06:00 committed by Mike Fleetwood
parent 12e960a61b
commit 1561d1ae7e
2 changed files with 24 additions and 1 deletions

View File

@ -135,6 +135,9 @@ private:
bool resize_move_filesystem_using_libparted( const Partition & partition_old,
const Partition & partition_new,
OperationDetail & operationdetail ) ;
void thread_lp_ped_file_system_resize( PedFileSystem * fs,
PedGeometry * lp_geom,
bool * return_value );
#endif
bool resize( const Partition & partition_old,
const Partition & partition_new,

View File

@ -2591,7 +2591,19 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
partition_new .sector_start,
partition_new .get_sector_length() ) ;
if ( lp_geom )
return_value = ped_file_system_resize( fs, lp_geom, NULL ) && commit( lp_disk ) ;
{
// Use thread for libparted FS resize call to avoid blocking GUI
Glib::Thread::create( sigc::bind<PedFileSystem *, PedGeometry *, bool *>(
sigc::mem_fun( *this, &GParted_Core::thread_lp_ped_file_system_resize ),
fs,
lp_geom,
&return_value ),
false );
Gtk::Main::run();
if ( return_value )
commit( lp_disk ) ;
}
ped_file_system_close( fs );
}
@ -2602,6 +2614,14 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
return return_value ;
}
void GParted_Core::thread_lp_ped_file_system_resize( PedFileSystem * fs,
PedGeometry * lp_geom,
bool * return_value )
{
*return_value = ped_file_system_resize( fs, lp_geom, NULL );
g_idle_add( (GSourceFunc)_mainquit, NULL );
}
#endif
bool GParted_Core::resize( const Partition & partition_old,