Re: Newbie Question: g_signal_*



John Darrington <jmd computer org> writes:

Clearly I'm missing something with the gobject signalling mechanism.

In the documentation, *all* the gtk_signal_* functions have a note 
saying: 
      gtk_signal_* is deprecated and should not be used in
      newly-written code.

which is not very useful as it doesn't say what *should* be used
instead.   I'm guessing that I should use g_signal_*

However when I look at g_signal_connect , the callback function has a 
signature of

        void GCallback (void);

which is not much use if I want to actually do something when I catch
the signal.  How do I get the data associated with the signal? And how
do I determine which object emitted the signal?

A dummy typedef has to be used because there is no one signature
for all signals -- different signals have different arguments
and return values.

Use the appropriate callback signature from the docs for the
signal you are connecting to, and cast it to a GCallback with the 
G_CALLBACK() macro.

[ gtk_signal_connect worked the same way, BTW ]

Regards,
                                        Owen



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