From 6a0e0031b194b0a7863f75e56619412f876d17ca Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 4 Jun 2019 05:54:16 +0200 Subject: [PATCH] builder: Make GListStore buildable Treats GListStore like any other object and allows 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; }