g_signal_emit_v (prev: 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. 
> > 
> > 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?

I'm sorry I'm still bothering with this, but the problem is really causing
me trouble. First, Havoc is right that I don't need an accumulator.
Second, this problem has been considered by many as a bug, and as a
feature by others. The thing is that apparently I should use
g_signal_emitv instead of gtk_signal_emit in order to set my default
return value as TRUE. 

In unserstand the behavor of gtk_signal_emit, which is a wrapper of
g_signal_emit_valist with has a va_list as argument and looks pretty
transparent to me. However the declaration of g_signal_emitv is absolutely
confusing and obscure to me and I have to clue how to call it:

void                  g_signal_emitv   (const GValue *instance_and_params,
                                        guint signal_id,
                                        GQuark detail,
                                        GValue *return_value);

Why are the arguments declared like this? Sorry for my ignorance. I've
seen that this functions is only used a couple of times in the entire
glib/gtk code, and I wonder if this could be rewritten in a more
transparent way. In any case, apprently this is my only way to emit a
signal and being able to preset my default value when no signal handlers
are connected to it, and I think that this fact is really disturbing. I
know that my ignorance in the case can be playing against me, but still I
need a way to get this effect, either calling a different function, either
with a dirty hack, a wrapper for signal_emit_v, or directly calling
g_signal_emit_v. I could write a wrappe a la gtk_signal_emit, I should 
have to transform my va_list into a GValue array
(instance_and_params) and I have no idea how it is defined what the
function is expecting.

 Has anybody had to deal with this problem and succesfully overcome it? Is
there any code available that I could use? Or simply, can anybody
enlighten me about this obscure matter ;-) (that shouldn't be this obscure
-- or maybe I'm too dumb).
Thanks a lot!

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