Re: default signal return value

From: Adrian Feiguin <feiguin magnet fsu edu>
> I'm implementing the signals for the gtkextra widgets, and I'm using the
> gtk code as a guideline. I'm a little confused about signals returning a
> bool value. I'm using g_signal_new with 
> _gtk_boolean_handled_accumulator:
>     g_signal_new ("my_signal",
>                    G_OBJECT_CLASS_TYPE (object_class),
>                    G_SIGNAL_RUN_LAST,
>                    G_STRUCT_OFFSET (GtkMyClass, my_signal),
>                    _gtk_boolean_handled_accumulator, NULL,
>                    _my_marshal_BOOLEAN__BOXED,
>                    GTK_TYPE_BOOL, 1,
>                    GTK_TYPE_BOXED);
> The problem is that the default return value (when there are no functions 
>  connected to the signal) is always FALSE. My previous
> implementation with 1.x could be set to TRUE. Is there a way to customize
> the default return value?
> Thanks!,

If I recall correctly, _gtk_boolean_handled_accumulator() was written
for use with the signals associated with GdkEvents, which is why
it behaves the way it does. You can fairly easily write your own
accumulator function which does what you want. Take a look at the
code for _gtk_boolean_handled_accumulator() to see how.

Ron Steinke

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]