Do not use g_error for a few more errors, instead set the GError sent in
2008-02-29 Johan Dahlin <johan@gnome.org> * gtk/gtkbuilder.c: * gtk/gtkbuilderparser.c: * gtk/gtkbuilderprivate.h: Do not use g_error for a few more errors, instead set the GError sent in through add_from_file/add_from_string. * tests/buildertest.c: Add a couple of new parsing tests. (#519199, Pavel Syomin) svn path=/trunk/; revision=19681
This commit is contained in:

committed by
Johan Dahlin

parent
9b440c1656
commit
a57b66aac2
@ -182,8 +182,9 @@ _gtk_builder_boolean_from_string (const gchar *string,
|
||||
}
|
||||
|
||||
static GObject *
|
||||
builder_construct (ParserData *data,
|
||||
ObjectInfo *object_info)
|
||||
builder_construct (ParserData *data,
|
||||
ObjectInfo *object_info,
|
||||
GError **error)
|
||||
{
|
||||
GObject *object;
|
||||
|
||||
@ -194,7 +195,10 @@ builder_construct (ParserData *data,
|
||||
|
||||
object_info->properties = g_slist_reverse (object_info->properties);
|
||||
|
||||
object = _gtk_builder_construct (data->builder, object_info);
|
||||
object = _gtk_builder_construct (data->builder, object_info, error);
|
||||
if (!object)
|
||||
return NULL;
|
||||
|
||||
g_assert (G_IS_OBJECT (object));
|
||||
|
||||
object_info->object = object;
|
||||
@ -345,7 +349,7 @@ parse_child (ParserData *data,
|
||||
|
||||
child_info->parent = (CommonInfo*)object_info;
|
||||
|
||||
object_info->object = builder_construct (data, object_info);
|
||||
object_info->object = builder_construct (data, object_info, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -644,8 +648,13 @@ parse_custom (GMarkupParseContext *context,
|
||||
{
|
||||
ObjectInfo* object_info = (ObjectInfo*)parent_info;
|
||||
if (!object_info->object)
|
||||
object_info->object = _gtk_builder_construct (data->builder,
|
||||
object_info);
|
||||
{
|
||||
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;
|
||||
@ -804,8 +813,12 @@ end_element (GMarkupParseContext *context,
|
||||
ObjectInfo *object_info = state_pop_info (data, ObjectInfo);
|
||||
ChildInfo* child_info = state_peek_info (data, ChildInfo);
|
||||
|
||||
object_info->object = builder_construct (data, object_info);
|
||||
|
||||
object_info->object = builder_construct (data, object_info, error);
|
||||
if (!object_info->object)
|
||||
{
|
||||
free_object_info (object_info);
|
||||
return;
|
||||
}
|
||||
if (child_info)
|
||||
child_info->object = object_info->object;
|
||||
|
||||
|
Reference in New Issue
Block a user