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:
Mike Fleetwood 2016-01-29 16:36:05 +00:00 committed by Curtis Gedak
parent c00927c23d
commit e67bbe906f
2 changed files with 2 additions and 20 deletions

View File

@ -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
int exit_status ;
unsigned int index ;
sigc::signal<void, OperationDetail *> signal_progress;
private:
void update_command_progress( OperationDetail *operationdetail );
void store_exit_status( GPid pid, int status );
bool running;
int pipecount;

View File

@ -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 ),
children[children.size() - 1],
&error ) );
sigc::connection c;
if ( flags & EXEC_PROGRESS_STDOUT && ! stream_progress_slot.empty() )
{
// Call progress tracking callback when stdout updates
outputcapture.signal_update.connect( sigc::bind( sigc::mem_fun( *this, &FileSystem::update_command_progress ),
&operationdetail ) );
c = signal_progress.connect( stream_progress_slot );
}
outputcapture.signal_update.connect( sigc::bind( stream_progress_slot, &operationdetail ) );
else if ( flags & EXEC_PROGRESS_STDERR && ! stream_progress_slot.empty() )
{
// Call progress tracking callback when stderr updates
errorcapture.signal_update.connect( sigc::bind( sigc::mem_fun( *this, &FileSystem::update_command_progress ),
&operationdetail ) );
c = signal_progress.connect( stream_progress_slot );
}
errorcapture.signal_update.connect( sigc::bind( stream_progress_slot, &operationdetail ) );
outputcapture.connect_signal();
errorcapture.connect_signal();
@ -160,17 +151,10 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
}
close( out );
close( err );
if ( c.connected() )
c.disconnect();
operationdetail.stop_progressbar();
return exit_status;
}
void FileSystem::update_command_progress( OperationDetail *operationdetail )
{
signal_progress.emit( operationdetail );
}
void FileSystem::set_status( OperationDetail & operationdetail, bool success )
{
operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR );