Re: [gtk-list] Re: problem with gtk_signal_connect_object



Hello,

> >
> > guint  gtk_signal_connect_object        (GtkObject           *object,
> >                                          const gchar         *name,
> >                                          GtkSignalFunc        func,
> >                                          GtkObject           *slot_object);
> >
> > simply means is pass slot_object as the first parameter to func, instead
> > of object.


> >
> > You can currently write:
> >
> >  gtk_signal_connect_object (object, "destroy",
> >                             GTK_SIGNAL_FUNC (g_free),
> >                             GTK_OBJECT (some_data_associated_with_object));
>                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                               this should have been
>                               (GtkObject*) some_data_associated_with_object

If the function will take a void* as 4th argument, not just a
GtkObject*, 
shouldn't the prototype be:

    guint  gtk_signal_connect_object        (GtkObject          
*object,
                                             const gchar         *name,
                                             GtkSignalFunc        func,
                                             gpointer           
*func_data);

just like for gtk_signal_connect? The required cast to GtkObject* seems
to be
unnecessary and misleading (it was for me).

It should be possible to make the change without breaking existing code, 
because GtkObject* should be compatible with gpointer.


Well, my thanks to Tim, gtk_signal_object_connect_while_alive gets me 
the behaviour I want.

Stefan



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