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.
<GtkFileChoser template> is a lot more helpful
than <input>.
This commit is contained in:
Matthias Clasen 2020-01-29 15:48:31 +01:00
parent bba5de7c6d
commit ab69d43089

View File

@ -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, "<input>",
_gtk_builder_parser_parse_buffer (builder, filename,
buffer, length,
NULL,
&tmp_error);
g_free (filename);
if (tmp_error != NULL)
{