Signal handlers: parameter names



I was thinking about tools like glade, and specifically a tool I wrote a
little while back called g2c, which converts glade XML files to C code. 
One of the problems I had then was that I could get the types of all of
the parameters to a signal, but I couldn't get the names of the
parameters.  It seems this is still an issue, since gtk_signal_new still
does not contain a place to name your signal's arguments.  This would be
enormously handy for tools like glade.  Right now we have to maintain
huge lists of signal handler names/parameters in our code, then do table
lookups on the lists to write out the C code.  If we could dynamically
discover the types AND names of the parameters, it would reduce the
amount of BS code we have to write a LOT.  It would also allow GUI
builders to handle new widget callbacks without recoding the builder.  

Here is my proposal:

guint
gtk_signal_new_with_names (const gchar *name,
                           GtkSignalRunType signal_flags,
                           GtkType object_type,
                           guint function_offset,
                           GtkSignalMarshaller marshaller,
                           GtkType return_val,
                           guint n_args,
                           gchar **arg_names,
                           GtkType *args);

arg_names would be a null-terminated list of strings corresponding to
the names of the arguments.

By using a new function name, we maintain code compatibility with
existing widgets (this seems to be a big topic today, so I thought I'd
mention it).  I could recode the core gtk+ classes to use
gtk_signal_new_with_names in a week or two, less with others' help.  If
this can't make it in to 1.4 I won't cry, but I'd like to see it in
there if possible.  

John




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