GObject: add g_signal_accumulator_first_wins

Deals with the case where we want exactly one signal handler to run.
This commit is contained in:
Ryan Lortie
2010-10-12 20:58:43 -04:00
parent 0c21689ed8
commit 15d87c2cc4
4 changed files with 40 additions and 0 deletions

View File

@@ -3439,5 +3439,38 @@ g_signal_accumulator_true_handled (GSignalInvocationHint *ihint,
return continue_emission;
}
/**
* g_signal_accumulator_first_wins:
* @ihint: standard #GSignalAccumulator parameter
* @return_accu: standard #GSignalAccumulator parameter
* @handler_return: standard #GSignalAccumulator parameter
* @dummy: standard #GSignalAccumulator parameter
*
* A predefined #GSignalAccumulator for signals intended to be used as a
* hook for application code to provide a particular value. Usually
* only one such value is desired and multiple handlers for the same
* signal don't make much sense (except for the case of the default
* handler defined in the class structure, in which case you will
* usually want the signal connection to override the class handler).
*
* This accumulator will use the return value from the first signal
* handler that is run as the return value for the signal and not run
* any further handlers (ie: the first handler "wins").
*
* Returns: standard #GSignalAccumulator result
*
* Since: 2.28
**/
gboolean
g_signal_accumulator_first_wins (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
g_value_copy (handler_return, return_accu);
return FALSE;
}
/* --- compile standard marshallers --- */
#include "gmarshal.c"