[gparted] Remove the unnecessary signal_progress (#760709)



commit e67bbe906ff761396968a93a57cd5de716fea5c6
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Jan 29 16:36:05 2016 +0000

    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

 include/FileSystem.h |    2 --
 src/FileSystem.cc    |   20 ++------------------
 2 files changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/include/FileSystem.h b/include/FileSystem.h
index bce53d3..7151055 100644
--- a/include/FileSystem.h
+++ b/include/FileSystem.h
@@ -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;
diff --git a/src/FileSystem.cc b/src/FileSystem.cc
index 10870b5..e83bbd7 100644
--- a/src/FileSystem.cc
+++ b/src/FileSystem.cc
@@ -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 );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]