Re: Problems with the data associated to a signal...



>  Ok, this may sound a bit strange, but I have observed a couple of times
>  that certain callback functions don't receive the
>  data which I pass in the func_data of
>      gint gtk_signal_connect (GtkObject *object, gchar *name,  GtkSignalFunc func, gpointer func_data)

You are most likely using incorrect prototypes for your signal
handlers.

Not all signal handlers are of the form

	void handler (GtkObject *object, gpointer user_data);

For example, event signals in widgets expect

	gint handler (GtkWidget *object, GdkEvent *event, gpointer user_data);

And then again, clist's select_row is like this:

	void handler (GtkCList *clist, gint row, gint column, GdkEvent *event, gpointer user_data);

The easiest way to figure out what the various signals expect is to
look in the Gtk header files.  Look for the *Class structure
definitions (i.e. GtkWidgetClass, GtkCListClass) and see what
parameters the signal handlers expect.  The class structures contain
pointers to the class' handler; for your own functions, just append a
user_data pointer to those prototypes.

For example, if you look at gtkclist.c, you'll see this:

	struct _GtkCListClass
	{
	  GtkContainerClass parent_class;

	  ...

	  void   (*click_column)        (GtkCList     *clist,
					 gint          column);

	  ...
	}

So if you want to connect to the click_column signal, use a function
like
p
	void my_click_column_handler (GtkCList *clist, gint column, gpointer user_data);

[Is this in the tutorial or info files?]

  Federico



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