Set an error if we encounter properties without values set (#451303,

* gtk/gtkbuilder.h (enum): 
    * gtk/gtkbuilderparser.c (end_element): 
    * tests/buildertest.c (test_parser): 
    Set an error if we encounter properties without values set
    (#451303, Philip Withnall)


svn path=/trunk/; revision=18252
This commit is contained in:
Johan Dahlin
2007-06-27 00:37:50 +00:00
parent 1d2955bcaf
commit ae800a34fa
4 changed files with 39 additions and 1 deletions

View File

@ -139,6 +139,24 @@ error_invalid_tag (ParserData *data,
line_number, char_number, tag);
}
static void
error_missing_property_value (ParserData *data,
GError **error)
{
gint line_number, char_number;
g_markup_parse_context_get_position (data->ctx,
&line_number,
&char_number);
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_MISSING_PROPERTY_VALUE,
"%s:%d:%d <property> must have a value set",
data->filename,
line_number, char_number);
}
static GObject *
builder_construct (ParserData *data,
ObjectInfo *object_info)
@ -707,6 +725,12 @@ end_element (GMarkupParseContext *context,
PropertyInfo *prop_info = state_pop_info (data, PropertyInfo);
CommonInfo *info = state_peek_info (data, CommonInfo);
if (!prop_info->data)
{
error_missing_property_value (data, error);
return;
}
/* Normal properties */
if (strcmp (info->tag.name, "object") == 0)
{