summaryrefslogtreecommitdiff
path: root/gtk/gtkbuilderparser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-02-06 18:53:06 -0500
committerMatthias Clasen <mclasen@redhat.com>2019-02-08 00:09:44 -0500
commited3b9669b3052c274df6e9a2c84a824c7e6d6161 (patch)
treec2276272eef13d2678efc7ab0901ea95a212e294 /gtk/gtkbuilderparser.c
parentad9c2a624fd53e0ffc9ca61828bdf362fbb68727 (diff)
downloadgtk+-ed3b9669b3052c274df6e9a2c84a824c7e6d6161.tar.gz
builder: Allow specifying objects inline
In addition to <property name="foo">bar</property> referring to an object with ID bar, we now also parse <property name="foo"><object>... to specify a property 'inline'.
Diffstat (limited to 'gtk/gtkbuilderparser.c')
-rw-r--r--gtk/gtkbuilderparser.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index 94c5b8b6c1..2c08df0f02 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -34,16 +34,6 @@
static void free_property_info (PropertyInfo *info);
static void free_object_info (ObjectInfo *info);
-enum {
- TAG_PROPERTY,
- TAG_MENU,
- TAG_REQUIRES,
- TAG_OBJECT,
- TAG_CHILD,
- TAG_SIGNAL,
- TAG_INTERFACE,
- TAG_TEMPLATE,
-};
static inline void
state_push (ParserData *data, gpointer info)
@@ -1066,6 +1056,12 @@ end_element (GMarkupParseContext *context,
{
ObjectInfo *object_info = state_pop_info (data, ObjectInfo);
ChildInfo* child_info = state_peek_info (data, ChildInfo);
+ PropertyInfo* prop_info = state_peek_info (data, PropertyInfo);
+
+ if (child_info && child_info->tag_type != TAG_CHILD)
+ child_info = NULL;
+ if (prop_info && prop_info->tag_type != TAG_PROPERTY)
+ prop_info = NULL;
if (data->requested_objects && data->inside_requested_object &&
(data->cur_object_level == data->requested_object_level))
@@ -1089,6 +1085,8 @@ end_element (GMarkupParseContext *context,
}
if (child_info)
child_info->object = object_info->object;
+ if (prop_info)
+ g_string_assign (prop_info->text, object_info->id);
if (GTK_IS_BUILDABLE (object_info->object) &&
GTK_BUILDABLE_GET_IFACE (object_info->object)->parser_finished)