GSignal connect with struct *pointer



Hi all!
Is it impossible to give a pointer of 'struct any_struct' to
g_signal_connect() for user data?
To explain my question: I have a struct like typedef struct _MyStruct MyStruct; struct _MyStruct {
        GtkWidget treeView;
        GtkTreeStore treeStore;
        .... some more widgets...
        };
And after setting all values of struct members i have MyStruct struct; g_signal_connect(G_OBJECT(struct.treeView),
                "row-expanded",
                G_CALLBACK(tree_callback),
                &struct);
I mean this is the right syntax. But in callback function i
make a test:
void tree_callback(GtkWidget *widget, MyStruct *struct) { (void)printf("Pointer of struct=%p
", struct);
        }
And now, when i try the callback function i see that the
pointer struct always has a different address as value.
If i make a simple 'tree_callback(widget, struct);' there is
no problem and 'printf(struct)' gives the real address of the
structure. But the 'g_signal_connect()' seems unable to give
the address of structure to callback. Why?
Mathew

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