Passing data to a callback (again)



I think I'm missing something fundamental here.  My understanding is that I can
pass one pointer to a callback and that's it.  And that works.

When I look at the example provided for "How do I validate/limit/filter the
input to a GtkEntry?" in the Gtk+ FAQ (version 2.18.9 in my case) I see that
the callback header looks like this:

void insert_text_handler (GtkEntry *entry, const gchar *text, gint length, gint
*position, gpointer data)

The g_signal connect line looks like this:

g_signal_connect(G_OBJECT(entry), "insert_text", G_CALLBACK
(insert_text_handler), NULL);

So we're passing NULL data to the callback function, but somehow that function
is receiving  const gchar *text, gint length, gint *position, gpointer data.

This obviously doesn't square with the idea that you can pass one single
pointer to a callback.

What have I missed?



-- 
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!



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