Search code examples
cwidgetgtk3glade

Find glade gtk3 widget by unique id


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 ?


Solution

  • 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.