[gtk: 1/2] levelbar: Chainup to parent buildable when handling custom tags



commit ea2c27c640c8f16f08ea4cb5aa008cc8bda8e4ab
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Mon Jul 6 21:23:43 2020 +0200

    levelbar: Chainup to parent buildable when handling custom tags
    
    This is necessary to handle <layout> tags.

 gtk/gtklevelbar.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index b879494f65..321c152128 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -725,6 +725,8 @@ static const GtkBuildableParser offset_parser =
   offset_start_element
 };
 
+static GtkBuildableIface *parent_buildable_iface;
+
 static gboolean
 gtk_level_bar_buildable_custom_tag_start (GtkBuildable       *buildable,
                                           GtkBuilder         *builder,
@@ -735,6 +737,10 @@ gtk_level_bar_buildable_custom_tag_start (GtkBuildable       *buildable,
 {
   OffsetsParserData *data;
 
+  if (parent_buildable_iface->custom_tag_start (buildable, builder, child,
+                                                tagname, parser, parser_data))
+    return TRUE;
+
   if (child)
     return FALSE;
 
@@ -767,7 +773,11 @@ gtk_level_bar_buildable_custom_finished (GtkBuildable *buildable,
   self = data->self;
 
   if (strcmp (tagname, "offsets") != 0)
-    goto out;
+    {
+      parent_buildable_iface->custom_finished (buildable, builder, child,
+                                               tagname, user_data);
+      return;
+    }
 
   for (l = data->offsets; l != NULL; l = l->next)
     {
@@ -775,7 +785,6 @@ gtk_level_bar_buildable_custom_finished (GtkBuildable *buildable,
       gtk_level_bar_add_offset_value (self, offset->name, offset->value);
     }
 
- out:
   g_list_free_full (data->offsets, (GDestroyNotify) gtk_level_bar_offset_free);
   g_slice_free (OffsetsParserData, data);
 }
@@ -783,6 +792,8 @@ gtk_level_bar_buildable_custom_finished (GtkBuildable *buildable,
 static void
 gtk_level_bar_buildable_init (GtkBuildableIface *iface)
 {
+  parent_buildable_iface = g_type_interface_peek_parent (iface);
+
   iface->custom_tag_start = gtk_level_bar_buildable_custom_tag_start;
   iface->custom_finished = gtk_level_bar_buildable_custom_finished;
 }


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