diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-11-17 20:15:54 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-11-18 06:00:02 -0500 |
commit | df455db2e320be73cbc39a67e69eeeee19375aba (patch) | |
tree | 06466d92e9c316088fdc3f3f2f6f594cc94986f6 /gtk/gtkbuilder.c | |
parent | c7870385c3075ec330618cba3d86bebc92816a61 (diff) | |
download | gtk+-df455db2e320be73cbc39a67e69eeeee19375aba.tar.gz |
GtkBuilder: Make IDs optional
One requirement of .ui files is that each object must have an ID,
even if it is never referred to or directly loaded from the code.
This makes editing .ui files much more onerous than it has to be,
due to the frequent need to invent new IDs, while avoiding
clashes.
This commit makes IDs optional in the XML. They only need to
be provided for objects which are referred to or explictly loaded
from the code. Since GtkBuilder needs IDs for its own internal
accounting, we create IDs of the form ___object_N___ if not
specified in the XML.
https://bugzilla.gnome.org/show_bug.cgi?id=712553
Diffstat (limited to 'gtk/gtkbuilder.c')
-rw-r--r-- | gtk/gtkbuilder.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index c6b6b2577a..695b53e79f 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -100,17 +100,12 @@ * specifying the id of the #GtkUIManager in the "constructor" attribute and the * name of the object in the "id" attribute. * - * Objects must be given a name with the "id" attribute, which allows the + * Objects may be given a name with the "id" attribute, which allows the * application to retrieve them from the builder with gtk_builder_get_object(). * An id is also necessary to use the object as property value in other parts of - * the UI definition. + * the UI definition. GTK+ reserves ids starting and ending with ___ (3 underscores) + * for its own purposes. * </para> - * <note><para> - * Prior to 2.20, GtkBuilder was setting the "name" property of constructed widgets to the - * "id" attribute. In GTK+ 2.20 or newer, you have to use gtk_buildable_get_name() instead - * of gtk_widget_get_name() to obtain the "id", or set the "name" property in your UI - * definition. - * </para></note> * <para> * Setting properties of objects is pretty straightforward with the * <property> element: the "name" attribute specifies the name of the |