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())
This commit is contained in:
parent
2a55c65876
commit
822028b504
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue