I've been trying to get the "names" of all GtkWidgets in a GtkBuilder object.
I've managed to get all objects from the builder object via gtk_builder_get_objects()
and store them in a GSList.
However, when I use gtk_widget_get_name()
on the gobjects (which i cast to GtkWidgets), I get generic names such as "GtkWindow" and "GtkButton" instead of "window1" or "button1" that are displayed in glade.
Any help would be extremely appreciated and would make this programmer very happy.
The names set for the builder are not the same as name of the
GtkWidget
.GtkBuilder
maintains an internal hash table which has the name set inGtkBuilder UI definitions
from the file or string (from which builder was added) and associated object. It is used to retrieve the objects whengtk_builder_get_object ()
is called. Make use of the"name"
property ofGtkWidget
. Set"name"
property in theGtkBuilder UI definitions
to set the name of theGtkWidget
which can be retrieved usinggtk_widget_get_name()
.Hope this helps!