From ab69d43089f62d2799e0c29cc981f2cda8c4d1df Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 29 Jan 2020 15:48:31 +0100 Subject: [PATCH] builder: Use a better name for templates This name can show up in error messages or profiler traces, so it is nice to provide some hint what file we are dealing with. is a lot more helpful than . --- gtk/gtkbuilder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index b98ab3566c..90b54e864d 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -1219,6 +1219,7 @@ gtk_builder_extend_with_template (GtkBuilder *builder, { GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder); GError *tmp_error; + char *filename; g_return_val_if_fail (GTK_IS_BUILDER (builder), 0); g_return_val_if_fail (GTK_IS_WIDGET (widget), 0); @@ -1234,11 +1235,13 @@ gtk_builder_extend_with_template (GtkBuilder *builder, priv->resource_prefix = NULL; priv->template_type = template_type; + filename = g_strconcat ("<", g_type_name (template_type), " template>", NULL); gtk_builder_expose_object (builder, g_type_name (template_type), G_OBJECT (widget)); - _gtk_builder_parser_parse_buffer (builder, "", + _gtk_builder_parser_parse_buffer (builder, filename, buffer, length, NULL, &tmp_error); + g_free (filename); if (tmp_error != NULL) {