0

In glade I can give a unique id to each widget, however in the c-code, I have no idea how I can make use of these id's.

The method "gtk_widget_get_name" seems to return something else. At least currently I only get the typenames from it, e.g. "GtkGrid", "GtkComboBoxText", "GtkStatusbar" ... thats probably the default if I did not set a different name in the c-code.

So how can I read the id of a gtkwidget, which I typed into glade ?

Alex
  • 1,602
  • 20
  • 33

1 Answers1

4

The Glade ID is used with gtk_builder_get_object() to retrieve an object or widget by its ID from a Glade file.

The name property which gtk_widget_get_name() retrieves, fulfills a different function: referring to your widget from a CSS file. It's for widgets only, not objects, and moreover there's nothing that forces it to be unique.

ptomato
  • 56,175
  • 13
  • 112
  • 165
  • Thank's alot, exactly the method I was looking for! – Alex Jul 10 '16 at 20:01
  • I just asked a [related question](https://stackoverflow.com/questions/38812379/how-can-i-read-out-the-glade-id-of-a-gtk3-object). Maybe you as well know the answer for this one. – Alex Aug 07 '16 at 08:37