Re: acces to a member of the principal widget



 Ok I understand I can give more than one argument to a callback function.
 But my question remains, how can I access to my list.

The most used ways:
1. Allocate the structure and pass it to signal's callback, in your case:
typedef struct _MyCallbackArgs
{
   GtkWidget *window;
   GtkWidget *dir_list;
} MyCallbackArgs;
...
MyCallbackArgs *args = g_new (MyCallbackArgs, 1);
args->window = pWindow, args->dir_list = DirList;
g_signal_connect (pMenuItem, "activate", G_CALLBACK (OnFile), args);

2. Use the g_object_get/set_data () functions to store a pointer you
need in either pMenuItem or pWindow:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#id2725187
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#id2725303

3. Use global variables.

You can search gtk-list and gtk-app-devel-list list to find some
additional info, there were many messages on this in the past.

Olexiy


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