After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 80487 - A generalized accumulator for signals that return gboolean
A generalized accumulator for signals that return gboolean
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
2.0.x
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2002-05-01 18:18 UTC by Ron Steinke
Modified: 2011-02-18 16:07 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
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. (652 bytes, text/plain)
2002-05-01 18:20 UTC, Ron Steinke
  Details
Non-generic patch with docs and test case (15.51 KB, patch)
2003-09-11 19:27 UTC, Owen Taylor
none Details | Review

Description Ron Steinke 2002-05-01 18:18:51 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.
Comment 1 Ron Steinke 2002-05-01 18:20:47 UTC
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.
Comment 2 Owen Taylor 2003-06-09 00:09:18 UTC
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].
Comment 3 Owen Taylor 2003-09-11 19:27:58 UTC
Created attachment 19874 [details] [review]
Non-generic patch with docs and test case
Comment 4 Owen Taylor 2003-09-12 20:38:49 UTC
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)