Re: default signal return value

Adrian Feiguin <feiguin magnet fsu edu> writes:
> 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:

You can't use _gtk_boolean_handled_accumulator - the reason it starts
with an underscore is that it's private. Your code normally would not
compile with this symbol referenced, it only works right now because
of a Linux-only libtool bug. Once the libtool bug is fixed all
underscore-prefixed symbols will no longer be exported from GTK.
>     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?

Are you sure you want an accumulator? It's only used for event signals
so that returning TRUE will end the signal emission.

To set the default return you may need to use g_signal_emitv() instead 
of g_signal_emit(), but I'm not sure.

Note that GTK_TYPE_ are all deprecated these days, there are G_TYPE


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