Glade, Libglade, and using user_data in callbacks



I have a global structure in my program and a generic callback routine for handling toggle button presses. I want to pass a reference to the global structure's parameter into the generic callback routine by setting the Object in the "Properties" Glade dialog box for a toggle button. I.e.

// The global structure with MY_GBOOLEAN parameter
my_structure GLOBAL_VAR;

// The generic callback routine
void
on_generic_toggle_btn_toggled( GtkToggleButton *toggle, gpointer user_data )
{
   gboolean *data = user_data;

   g_print("the data was %s.\n", *data ? "TRUE" : "FALSE");

   *data = 0; //state of the toggle button
}

In the Glade Object box for the toggled event callback I've placed: "&GLOBAL_VAR.MY_GBOOLEAN"

What am I missing? I'm using libglade to load the interface, so I'm not sure if that can actually link up the global variable when the callback routine is connected to the widget's toggled signal.

Thanks.



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