mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-28 21:03:29 +02:00
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:
@@ -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"
|
||||
|
Reference in New Issue
Block a user