Re: Put g_signal_connect() back!



Tim Janik <timj gtk org> writes: 
> guint    g_signal_connect                     (gpointer           instance,
>                                                const gchar       *detailed_signal,
>                                                GCallback          c_handler,
>                                                gpointer           data,
>                                                gboolean           swapped);

The problem with this is the same problem with gtk_box_pack_start();
boolean args are very unreadable.

i.e. if I have this code:

 g_signal_connect (instance, "foo", callback, data, TRUE);

it's much harder to see that data/instance will get swapped, because I
have to have memorized the function prototype, it's much easier in
this case:
 
 g_signal_connect_swapped (instance, "foo", callback, data);

enums or flags are also better than the boolean:

 g_signal_connect (instance, "foo", callback, data, G_SIGNAL_SWAPPED);

things are worse for connect_data:

 g_signal_connect_data (instance, "foo", callback, data, dnotify, TRUE, FALSE);

since you not only have to remember what the bools mean, you also have
to remember what order they are in, and I constantly forget this for
box_pack_start() even after 2+ years of GTK programming.

Havoc





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