[gtk/for-master: 89/91] builder: Make GListStore buildable
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/for-master: 89/91] builder: Make GListStore buildable
- Date: Tue, 4 Jun 2019 04:16:29 +0000 (UTC)
commit 6a0e0031b194b0a7863f75e56619412f876d17ca
Author: Benjamin Otte <otte redhat com>
Date: Tue Jun 4 05:54:16 2019 +0200
builder: Make GListStore buildable
Treats GListStore like any other object and allows <child> to add items
to it.
gtk/gtkbuilder.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index 2f5ba245e9..63cb6a6a2e 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -925,13 +925,27 @@ _gtk_builder_add (GtkBuilder *builder,
g_assert (object != NULL);
parent = ((ObjectInfo*)child_info->parent)->object;
- g_assert (GTK_IS_BUILDABLE (parent));
GTK_NOTE (BUILDER,
g_message ("adding %s to %s", object_get_name (object), object_get_name (parent)));
- gtk_buildable_add_child (GTK_BUILDABLE (parent), builder, object,
- child_info->type);
+ if (G_IS_LIST_STORE (parent))
+ {
+ if (child_info->type != NULL)
+ {
+ GTK_BUILDER_WARN_INVALID_CHILD_TYPE (parent, child_info->type);
+ }
+ else
+ {
+ g_list_store_append (G_LIST_STORE (parent), object);
+ }
+ }
+ else
+ {
+ g_assert (GTK_IS_BUILDABLE (parent));
+ gtk_buildable_add_child (GTK_BUILDABLE (parent), builder, object,
+ child_info->type);
+ }
child_info->added = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]