Re: User defined signals for GtkWidget



On Sun, 2003-10-26 at 08:50, Matthias Mann wrote:
In an older documentation of Gtk+ i saw this function:
    
gtk_object_class_user_signal_new()
    
This could be a good solution for adding a special needed
signal to an existing GtkWidget without creating a new
object based on the needed widget class. But this feature
seems to be removed from Gtk2.x. Had nothing found about in
API. Is there a similar possibility to add a user defined
signal to a widget?

Simply pass 0 for the struct_offset field in g_signal_new()
and you'll get the same effect.

But doing this on someone else's class is not a good idea for
the same reason gtk_object_class_user_signal_new() was not 
a good idea ... you are adding that signal to *all* instances
of that widget class, globally in your entire process.

(If you proceed anyways, make sure you use a namespaced
signal name ... e.g., "myprog-something-happened" rather than
"something-happened")

Regards,
                                        Owen





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