Re: Threads & Glade
- From: Iago Rubio <iago iagorubio com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Threads & Glade
- Date: Sat, 08 Oct 2005 09:19:48 +0200
On Thu, 2005-10-06 at 02:04 -0700, lucapetra (sent by Nabble.com) wrote:
thanks, i had just modified the makefile as follows
....
CFLAGS= ... 'pkg-config --cflags gtk+-2.0 gthread-2.0'
....
LIBS='pkg-config --libs gtk+-2.0 gthread-2.0'
Now it's all right ;) .
For sure ... if you've got both libraries .. but if you don't ...
What about a test after that ?
echo -n "checking for gtk+-2.0 ... "
if pkg-config --exists gtk+-2.0 ; then
echo "yes"
else
echo "no"
AC_MSG_ERROR(gthread-2.0 not found, please install it)
fi
echo -n "checking for gthread-2.0 ... "
if pkg-config --exists gthread-2.0 ; then
echo "yes"
else
echo "no"
AC_MSG_ERROR(gtk+-2.0 not found, please install it)
fi
I have another question. I have to pass from main.c to the gtk interface an array pointer. How can i do
this? I think using the pointer instead of argv...but i don't know how to read the argument in the gtk
callbacks
int main (int argc, char **argv)
{
gchar ** array;
// do your stuff
window = create_window(array);
....
}
GtkWidget*
create_window(gchar** array)
{
// from here you can pass it to callbacks
}
Even better you can create an struct with all the data you need:
typedef struct _MyData {
gchar ** array;
....
....
....
} MyData;
int main (int argc, char **argv)
{
gchar ** array;
MyData *data;
// do your stuff
data = g_malloc(sizeof(MyData));
data->array = array;
window = create_window(data);
gtk_widget_show(window);
gtk_main();
// out the main loop free data
g_free(data);
....
}
GtkWidget*
create_window(MyData *data)
{
gchar** array;
array = data->array;
// from here you can pass it to callbacks
}
Hope this helps.
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]