Re: g_signal_connect isn't working
- From: Olexiy Avramchenko <olexiy ctech cn ua>
- To: Pier-Luc Charbonneau <pierluc charbonneau gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_signal_connect isn't working
- Date: Fri, 11 Mar 2005 09:16:58 +0200
Pier-Luc Charbonneau wrote:
static gboolean recalculate_psi_consumption(GtkWidget *widget, gpointer data)
This is your callback declaration. It takes 2 parameters.
g_signal_connect(G_OBJECT(start),"key_press_event",G_CALLBACK(recalculate_psi_consumption),(gpointer)psi);
"key-press-event" signal handler must take 3 parameters, look at:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-key-press-event
You have to make a wrapper over your callback, smth like:
static gboolean wrapper (GtkWidget *widget, GdkEvent *event, gpointer data)
{
recalculate_psi_consumtion (widget, data);
return FALSE; /* or TRUE if you dont want other callbacks to pop-up */
}
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(recalculate_psi_consumption),(gpointer)psi);
This one is Ok. "clicked" callback takes 2 parameters, like your callback.
Keep in mind that all "*-event" callbacks want three parameters: widget, event
structure and user data. Even more - they should return gboolean value: TRUE
means that event was processed and FALSE means that event wasn't processed and
all other callbacks will be called.
Olexiy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]