RE: Extra callback parameters
- From: <martyn 2 russell bt com>
- To: <rjshaw iprimus com au>, <gtk-app-devel-list gnome org>
- Subject: RE: Extra callback parameters
- Date: Wed, 22 Oct 2003 16:45:05 +0100
Hi,
I have a callback that is passed one user data item (cdata):
void colour_cb(GtkButton *button, gpointer data)
{...
}
g_signal_connect(G_OBJECT(colbutton),"clicked",G_CALLBACK(colo
ur_cb),cdata);
Is it possible to modify g_object signals so that more than
one data parameter can be passed like:
void colour_cb(GtkButton *button, gpointer data1, gpointer data2)
{...
}
g_signal_connect(G_OBJECT(colbutton),"clicked",G_CALLBACK(colo
ur_cb),cdata1,cdata2);
You can always use this method...:
g_object_set_data(G_OBJECT(colbutton), "key1", GINT_TO_POINTER(1));
g_object_set_data(G_OBJECT(colbutton), "key2", GINT_TO_POINTER(2));
.
.
then
int a = 0;
a = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(colbutton), "key1"));
b = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(colbutton), "key2"));
.
.
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]