[gtk/overlay-layout] builder-tool: Convert overlay child properties



commit 37ca6b67d4d3bd4c059f5f7a03ef206cac4f051a
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 28 12:21:52 2019 -0400

    builder-tool: Convert overlay child properties

 gtk/tools/gtk-builder-tool-simplify.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/gtk/tools/gtk-builder-tool-simplify.c b/gtk/tools/gtk-builder-tool-simplify.c
index e447ac447d..37c93211c4 100644
--- a/gtk/tools/gtk-builder-tool-simplify.c
+++ b/gtk/tools/gtk-builder-tool-simplify.c
@@ -200,6 +200,8 @@ keep_for_rewrite (const char *class_name,
     { "GtkToolbar", "homogeneous", 1 },
     { "GtkPaned", "resize", 1 },
     { "GtkPaned", "shrink", 1 },
+    { "GtkOverlay", "measure", 1 },
+    { "GtkOverlay", "clip-overlay", 1 },
   };
   gboolean found;
   gint k;
@@ -253,6 +255,7 @@ is_container_element (Element *element)
    */
   const char *names[] = {
     "packing",
+    "layout",
     "cell-packing",
     "attributes",
     "action-widgets",
@@ -1068,6 +1071,32 @@ rewrite_paned (Element *element,
     rewrite_paned_child (element, data, child2, "child2");
 }
 
+static void
+rewrite_layout_props (Element *element,
+                      MyParserData *data)
+{
+  GList *l, *ll;
+
+  for (l = element->children; l; l = l->next)
+    {
+      Element *elt = l->data;
+
+      if (g_str_equal (elt->element_name, "child"))
+        {
+          for (ll = elt->children; ll; ll = ll->next)
+            {
+              Element *elt2 = ll->data;
+
+              if (g_str_equal (elt2->element_name, "packing"))
+                {
+                  g_free (elt2->element_name);
+                  elt2->element_name = g_strdup ("layout");
+                }
+            }
+        }
+    }
+}
+
 static gboolean
 simplify_element (Element      *element,
                   MyParserData *data)
@@ -1139,6 +1168,10 @@ simplify_element (Element      *element,
           g_str_equal (get_class_name (element), "GtkPaned"))
         rewrite_paned (element, data);
 
+      if (g_str_equal (element->element_name, "object") &&
+          g_str_equal (get_class_name (element), "GtkOverlay"))
+        rewrite_layout_props (element, data);
+
       if (g_str_equal (element->element_name, "property") &&
           property_has_been_removed (element, data))
         return TRUE;


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