How to get a widget from its parent of parent(...) by name?



Hi,

I'm migrating a project from GnomeDruid/Libglade to GtkAssistant/GtkBuilder.
I got a problem of replacing 'glade_xml_get_wiget()'.

The ui structure is like following:

GtkAssistant assistant
 \
  GtkVBox vbox1
      \
      GtkRadioButton button1
           |
      GtkRadioButton button2

In the previous code, if we want to get the button2, then we just call
'glade_get_widget_tree(widget)' to get the GladeXml, and then call
'glade_xml_get_widget(xml, "button2")', which will search for the name
'button2' and return the GtkWidget for the 'button2'.

How can I do this if I migrate to GtkBuilder? There is no similar function
of 'glade_xml_get_widget()'. I know I can use 'g_object_get_data()' to get
button1 from vbox1, but how to get it from 'assistant'?

Maybe it's not too bad to locate 'vbox1' first then get 'button1' in this
sample, however, it gets much worse if the structure has more layer, and the
'button1' is down to the leaf.

How to get an widget from it's parent of parent (...) by name? Thanks.


-- 
Regards

Tao Wang



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