summaryrefslogtreecommitdiff
path: root/gtk/gtkbuilderparser.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-03-01 13:49:06 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-03-01 13:49:06 +0000
commita57b66aac2a2c174993dd70e833072937e8dba66 (patch)
tree791fa29692875100f1addce087d9b049bf491f86 /gtk/gtkbuilderparser.c
parent9b440c1656116d315d43378e9ccb34dd5d760fd1 (diff)
downloadgtk+-a57b66aac2a2c174993dd70e833072937e8dba66.tar.gz
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
Diffstat (limited to 'gtk/gtkbuilderparser.c')
-rw-r--r--gtk/gtkbuilderparser.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index ded89e316f..76e633e874 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -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;