Re: Fixed: GSignal connect with struct *pointer
- From: David Odin <David dindinx org>
- To: Matthias Mann <matman matman24 org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Fixed: GSignal connect with struct *pointer
- Date: Sun, 10 Aug 2003 23:18:32 +0200
On Sun, Aug 10, 2003 at 10:12:27PM +0200, Matthias Mann wrote:
On Saturday August 09 2003 13:57 CEST, Leandro A. F. Pereira
Sure it's possible :)
Thanx to God ore something else. I got an idea and found two
important mistakes in my code. And also a bad discription
about g_signal_connect() in libglib API:
The G_CONNECT_SWAPPED flag is explained with "wether the
instance and data should be swapped when calling the handler".
This is very idiocy. I mean, nobody will get the idea to swap
the instance with the user datas.
I find out: without G_CONNECT_SWAPPED no data will be send to
the callback function. So the API of g_signal_connect() should
#define g_signal_connect(instance, detailed-signal,
_NO_ user data. To send user data to a callback function the
only way is to use g_signal_connect_swapped(). That's it! Or
did i oversee any thing?
Yes you did!
The documentation of g_signal_connect is of course right. But you've
forgotten to read the documentation of the "row-expanded" signal.
You can read that the prototype for all the callback connected to this
signal should be:
void user_function(GtkTreeView *treeview,
or, if you use g_signal_connect_swapped (notice that user_data and
treeview are "swapped"):
void user_function(gpointer user_data,
It isn't at all idiotic to swap the instance with the user data. This
will let one to destroy a dialog when a button is pressed with this
david dindinx org
] [Thread Prev