[gtk/builder-precompile: 1/5] builder: Use a better name for templates



commit 2a6ac09c1be5fa9abfcd74490d29184feb753fff
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 29 15:48:31 2020 +0100

    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>.

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]