[gparted] Always be explicit when emitting a signal by calling emit()



commit 822028b504f0b85830bb15a0762def49cc30674f
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Jan 9 09:28:27 2016 +0000

    Always be explicit when emitting a signal by calling emit()
    
    Mostly the code is explicit and calls the emit() method when emitting a
    signal [1], like this:
        signal_name.emit();
    
    However there are a few cases which use the function call operator on
    the signal object [2], like this:
        signal_name();
    
    The behaviour is identical [3] but it is preferred to be explicit that a
    signal callback is being initiated, and it also makes them much easier
    to search for too.
    
    [1] List explicit emit() signal calls
            fgrep '.emit(' src/*.cc
    
    [2] List function call operator emitted signals
            egrep "`sed -n '/sigc::signal/s/.*sigc::signal.*> *\([a-zA-Z_]*\).*/\1/p' include/*.h | tr '\n' 
'|' | sed 's/\(.*\).$/[^a-zA-Z_](\1)\\\(/'`" src/*.cc
    
    [3] Quote from the libsigc++ Reference Manual, class sigc::signal
        
https://developer.gnome.org/libsigc++/stable/classsigc_1_1signal7.html#ab37db0ecc788824d0baa3c301efc8dcd
    
            result_type sigc::signal<...>::operator()(...)
    
            Triggers the emission of the signal (see emit())

 src/Dialog_Progress.cc |    2 +-
 src/OperationDetail.cc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/Dialog_Progress.cc b/src/Dialog_Progress.cc
index 8c328b5..90f1a97 100644
--- a/src/Dialog_Progress.cc
+++ b/src/Dialog_Progress.cc
@@ -339,7 +339,7 @@ void Dialog_Progress::on_cancel()
                                sigc::mem_fun(*this, &Dialog_Progress::cancel_timeout), 1000 );
                }
                else cancelbutton->set_label( _("Force Cancel") );
-               operations[t]->operation_detail.signal_cancel( cancel );
+               operations[t]->operation_detail.signal_cancel.emit( cancel );
                cancel = true;
        }
 }
diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc
index b73a1fd..3b9ac8c 100644
--- a/src/OperationDetail.cc
+++ b/src/OperationDetail.cc
@@ -190,7 +190,7 @@ void OperationDetail::cancel( bool force )
                cancelflag = 2;
        else
                cancelflag = 1;
-       signal_cancel(force);
+       signal_cancel.emit( force );
 }
 
 ProgressBar & OperationDetail::get_progressbar() const


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