Re: Pass 2 or more widgets in callback



I have a doubt. I have a program, that listens on port 3000. Then, i
defined an idle function, wich accepts incoming connections and binds
the incoming connection to a IO callback (gdk_input_add). 
But i have to remove the callback when the connection is finished, so I
did a
g_malloc(sizeof int), and passed the tag return by gdk_input_add to the
callback this way:


*tag = gdk_input_add(read_socket, GDK_INPUT_READ,
GTK_SIGNAL_FUNC(ler_socket), tag);

Then, inside the ler_socket function, i read the socket, and, if the
connect was ended, i did a gdk_input_remove(*tag) and a g_free(tag), so
that i dint have any leaks.
It worked ok (at least it seemed). But i was printing the data to the
console. Now, i want to set the text of a gtk_label with the data. I
cant set the tag as a _set_data, becouse there will be many diferent
tags (each connection) to only 1 widget.
So, i think the best would be to pass an array with tag and label. But i
just can't get it to work.
Does anyone have a tip, a code sample of how to do this?

Thanks in advance,
Paulo Schreiner





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