static GObject * builder_construct (ParserData *data, ObjectInfo *object_info, GError **error) { GObject *object; g_assert (object_info != NULL); if (object_info->object && object_info->applied_properties) return object_info->object; object_info->properties = g_slist_reverse (object_info->properties); if (object_info->object == NULL) { object = _gtk_builder_construct (data->builder, object_info, error); if (!object) return NULL; } else { /* We're building a template, the object is already set and * we just want to resolve the properties at the right time */ object = object_info->object; _gtk_builder_apply_properties (data->builder, object_info, error); } object_info->applied_properties = TRUE; g_assert (G_IS_OBJECT (object)); object_info->object = object; return object; }
static GObject * builder_construct (ParserData *data, ObjectInfo *object_info, GError **error) { GObject *object; g_assert (object_info != NULL); if (object_info->object) return object_info->object; object_info->properties = g_slist_reverse (object_info->properties); object = _gtk_builder_construct (data->builder, object_info, error); if (!object) return NULL; g_assert (G_IS_OBJECT (object)); object_info->object = object; return object; }
static gboolean parse_custom (GMarkupParseContext *context, const gchar *element_name, const gchar **names, const gchar **values, ParserData *data, GError **error) { CommonInfo* parent_info; GMarkupParser parser; gpointer subparser_data; GObject *object; GObject *child; parent_info = state_peek_info (data, CommonInfo); if (!parent_info) return FALSE; if (strcmp (parent_info->tag.name, "object") == 0 || strcmp (parent_info->tag.name, "template") == 0) { ObjectInfo* object_info = (ObjectInfo*)parent_info; if (!object_info->object) { object_info->properties = g_slist_reverse (object_info->properties); object_info->object = _gtk_builder_construct (data->builder, object_info, error); if (!object_info->object) return TRUE; /* A GError is already set */ } g_assert (object_info->object); object = object_info->object; child = NULL; } else if (strcmp (parent_info->tag.name, "child") == 0) { ChildInfo* child_info = (ChildInfo*)parent_info; _gtk_builder_add (data->builder, child_info); object = ((ObjectInfo*)child_info->parent)->object; child = child_info->object; } else return FALSE; if (!gtk_buildable_custom_tag_start (GTK_BUILDABLE (object), data->builder, child, element_name, &parser, &subparser_data)) return FALSE; data->subparser = create_subparser (object, child, element_name, &parser, subparser_data); if (parser.start_element) parser.start_element (context, element_name, names, values, subparser_data, error); return TRUE; }