can't find widget in callback function



This problem is probably due to my inexperience programming in Gtk but
I am stuck so I could use some help. Also, I am using libglade to
create my widgets, so this could be a glade problem too. Its more
likely that my logics bad though.

I am trying to de-expand all GtkExpander widgets in a notebook when
the user switches pages. However, I don't seem to be able to reference
the expander widget in the callback. The code goes...

nb_page_switch (GtkWidget *nb, GtkWidget *w)
{
   GtkWidget *expander
   
   expander = GTK_EXPANDER (glade_xml_get_widget (w->xml,  "expander1")
   // i get no reference to the expander widget. if I try to print it I get a 0

notebook_expanders (Widget *w)
{
   GtkExpander *expander
   GtkNotebook *nb

    // I can access both widgets below fine
   expander = glade_xml_get_widget (w->xml, "expander1")
   notebook = glade_xml_get_widget (w->xml, "notebook1")
   
   g_signal_connect_after (GTK_NOTEBOOK (nb),  "switch-page",
G_CALLBACK (nb_page_switch), w)

}
   
I tried passing the expander in the g_signal_connect after ( .. , ...
, ... , expander). If I try to print it in the callback function the
pointer seems to jump all around, but never seems to point to the
original memory location of the expander in the notebook_expanders
function.

What am I doing wrong here?

TIA
-- 
- Jim Pharis



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