GNOME Bugzilla – Bug 80487
A generalized accumulator for signals that return gboolean
Last modified: 2011-02-18 16:07:08 UTC
Add a function that provides a generalized accumulator for signals with a gboolean return value. This accumulator halts signal emmision when one of (TRUE, FALSE) is recieved, and returns the value of the last emmision. Which of (TRUE, FALSE) to halt on is specified by passing the appropriate halt value as the signal data using GINT_TO_POINTER(). This accumulator handles the (vastly) most common case where signals do not return void.
Created attachment 8100 [details] The function source. I'm not sure which file in gobject to put this in, so I'm just providing it as plain text code, not a diff.
I think non-generalization is better - like the private GTK+ function. I have 3 concerns about generalization: - It's complexity for no good reason. - The normal case requires G_POINTER_TO_UINT(TRUE), which is wrong. - We shouldn't be encouraging signals that could work either way. We really, really, want everybody to use the TRUE-stops-emit convention. I'd also use the private GTK+ functions name - g_boolean_handled_accumulator(). I'd put it in gsignal.[ch].
Created attachment 19874 [details] [review] Non-generic patch with docs and test case
Fri Sep 12 16:31:40 2003 Owen Taylor <otaylor@redhat.com> * gsignal.[ch]: Add g_signal_accumulator_true_handled(), to do TRUE-stops-emit signals. (#80487, Ron Steinke)