Using g_signal_connect on GtkMenuItem with data



Hello,

I am trying to pass data to a GCallback when a GtkMenuItem "activate" event occurs.
The data passed to g_signal_connect is fine but when the callback is called, data is always NULL.
Does someone can help me to fix this bug ?

Thanks,

Here is  sample code :


GtkTextBuffer * log_buffer = gtk_text_buffer_new(NULL);
// Here log_buffer != NULL

g_signal_connect ((gpointer) item_cut, "activate",
            G_CALLBACK (on_cut_activate),
            log_buffer);

...

void on_cut_activate(GtkMenuItem *menuitem, gpointer user_data)
{
    GtkTextBuffer * buffer = GTK_TEXT_BUFFER(user_data);
    // Here user data == NULL so the cast fail
}



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