Remove the unnecessary signal_progress (#760709)
For the relevant stream from a file system specific command being tracked, there were 2 callbacks attached: update_command_output() and update_command_progress(). When called, update_command_progress() just emitted signal_progress to call the file system specific progress tracker callback. Like this: signal_update.emit() -> update_command_output() -> update_command_progress() signal_progress.emit() -> {CLASS}::{NAME}_progress() Instead just connect the file system specific progress tracker callback directly to signal_update and bypass the unnecessary update_command_progress() method and the signal_progress signal. Like this: signal_update.emit() -> update_command_output() -> {CLASS}::{NAME}_progress() Bug 760709 - Add progress bars to XFS and EXT2/3/4 file system specific copy methods
This commit is contained in:
parent
c00927c23d
commit
e67bbe906f
|
@ -103,10 +103,8 @@ protected:
|
||||||
Sector T, N, S ; //File system [T]otal num of blocks, [N]um of free (or used) blocks, block [S]ize
|
Sector T, N, S ; //File system [T]otal num of blocks, [N]um of free (or used) blocks, block [S]ize
|
||||||
int exit_status ;
|
int exit_status ;
|
||||||
unsigned int index ;
|
unsigned int index ;
|
||||||
sigc::signal<void, OperationDetail *> signal_progress;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_command_progress( OperationDetail *operationdetail );
|
|
||||||
void store_exit_status( GPid pid, int status );
|
void store_exit_status( GPid pid, int status );
|
||||||
bool running;
|
bool running;
|
||||||
int pipecount;
|
int pipecount;
|
||||||
|
|
|
@ -126,21 +126,12 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
|
||||||
errorcapture.signal_update.connect( sigc::bind( sigc::ptr_fun( update_command_output ),
|
errorcapture.signal_update.connect( sigc::bind( sigc::ptr_fun( update_command_output ),
|
||||||
children[children.size() - 1],
|
children[children.size() - 1],
|
||||||
&error ) );
|
&error ) );
|
||||||
sigc::connection c;
|
|
||||||
if ( flags & EXEC_PROGRESS_STDOUT && ! stream_progress_slot.empty() )
|
if ( flags & EXEC_PROGRESS_STDOUT && ! stream_progress_slot.empty() )
|
||||||
{
|
|
||||||
// Call progress tracking callback when stdout updates
|
// Call progress tracking callback when stdout updates
|
||||||
outputcapture.signal_update.connect( sigc::bind( sigc::mem_fun( *this, &FileSystem::update_command_progress ),
|
outputcapture.signal_update.connect( sigc::bind( stream_progress_slot, &operationdetail ) );
|
||||||
&operationdetail ) );
|
|
||||||
c = signal_progress.connect( stream_progress_slot );
|
|
||||||
}
|
|
||||||
else if ( flags & EXEC_PROGRESS_STDERR && ! stream_progress_slot.empty() )
|
else if ( flags & EXEC_PROGRESS_STDERR && ! stream_progress_slot.empty() )
|
||||||
{
|
|
||||||
// Call progress tracking callback when stderr updates
|
// Call progress tracking callback when stderr updates
|
||||||
errorcapture.signal_update.connect( sigc::bind( sigc::mem_fun( *this, &FileSystem::update_command_progress ),
|
errorcapture.signal_update.connect( sigc::bind( stream_progress_slot, &operationdetail ) );
|
||||||
&operationdetail ) );
|
|
||||||
c = signal_progress.connect( stream_progress_slot );
|
|
||||||
}
|
|
||||||
outputcapture.connect_signal();
|
outputcapture.connect_signal();
|
||||||
errorcapture.connect_signal();
|
errorcapture.connect_signal();
|
||||||
|
|
||||||
|
@ -160,17 +151,10 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
|
||||||
}
|
}
|
||||||
close( out );
|
close( out );
|
||||||
close( err );
|
close( err );
|
||||||
if ( c.connected() )
|
|
||||||
c.disconnect();
|
|
||||||
operationdetail.stop_progressbar();
|
operationdetail.stop_progressbar();
|
||||||
return exit_status;
|
return exit_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystem::update_command_progress( OperationDetail *operationdetail )
|
|
||||||
{
|
|
||||||
signal_progress.emit( operationdetail );
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileSystem::set_status( OperationDetail & operationdetail, bool success )
|
void FileSystem::set_status( OperationDetail & operationdetail, bool success )
|
||||||
{
|
{
|
||||||
operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR );
|
operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR );
|
||||||
|
|
Loading…
Reference in New Issue