Up: GObject Signals   [Contents][Index]


2.5.3.1 Signal Accumulators

The signal accumulator is a special callback procedure that gets called during a signal emission. The “accumulator” nomenclature comes from the common case where one wants to collect the return values of signal emissions. In Scheme terms, the accumulator can be compared to a fold procedure that gets called on signal emission results.

When specified, the signal accumulator is a procedure with two input arguments: seed and current. The input value seed is a value created by the previous call to the accumulator. The first time the accumulator is called, seed will zero for signals that return numeric types. The input value current is the return value of the just emitted signal.

The accumulator procedure should return zero, one, or two values.

If at any time seed would be set to an incorrect value or more than two values are returned signal handling is aborted.