Re: g_signal_*



Johannes Stezenbach <js convergence de> writes:

> Owen Taylor wrote:
> > 
> >  3b) Modify the prototype of g_signal_connect_object() to match.
> 
> I think it is confusing that g_signal_connect_object() vs.
> g_signal_connect() are not like gtk_signal_connect_object()
> vs. gtk_signal_connect().
 
Yes, I thought about adding this to the list of things to
fix.

While g_signal_connect_object() is a reasonable name by
itself, the fact that it is something completely different
than gtk_signal_connect_object() is a problem.
 
> Maybe more a documentation than an API issue:
> 
> When would I use g_signal_connect_object()?

g_signal_connect_object() is a variant of g_signal_connect()
to be used when the 'data' object is a GObject. Using this
has two benefits:

 - Somewhat similar to gtk_signal_connect_while_alive(), 
   if the object passed as data goes away, the signal 
   connection will be removed.

 - While the signal is being invoked, an additional reference 
   count is added to the data object, possibly preventing 
   reentrancy problems.

As you point, unlike gtk_signal_connect_object(), 
g_signal_connect_object does NOT imply G_CONNECT_SWAPPED.
Which will definitely confuse people.
 
> Why aren't gtk_signal_connect_full() and g_object_connect()
> implemented using g_signal_connect_object() but via
> g_signal_connect_data()?

Should be obvious from the above - unless we know the
data member is a GObject, we can't use g_signal_connect_object.

Regards,
                                        Owen




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