[glade/composite-templates-new: 1/4] Support load and save of files with a <template> element.



commit 766c329d4c99f2c0d01f78ee375dc76efa04d5ef
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat Mar 30 20:00:52 2013 +0900

    Support load and save of files with a <template> element.
    
    GladeWidget now has a "parent-name" property which specifies
    the class from which a template derives. Loading and Saving
    code now takes <template> tags into account.
    
    A GladeWidget is instanciated slightly differently for a <template>
    (the parent-name class is used for instantiation).

 gladeui/glade-project.c   |    6 ++-
 gladeui/glade-property.c  |    5 +-
 gladeui/glade-widget.c    |  127 +++++++++++++++++++++++++++++++++++++++------
 gladeui/glade-widget.h    |    5 ++
 gladeui/glade-xml-utils.h |    1 +
 plugins/gtk+/glade-gtk.c  |  100 ++++++++++++++++++++++++------------
 6 files changed, 191 insertions(+), 53 deletions(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 4f8a0e7..4a8c198 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -1478,7 +1478,8 @@ glade_project_count_xml_objects (GladeProject *project,
   for (node = glade_xml_node_get_children (root);
        node; node = glade_xml_node_next (node))
     {
-      if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))
+      if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+         glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE))
         count = glade_project_count_xml_objects (project, node, ++count);
       else if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_CHILD))
         count = glade_project_count_xml_objects (project, node, count);
@@ -1663,7 +1664,8 @@ glade_project_load_internal (GladeProject *project)
        node; node = glade_xml_node_next (node))
     {
       /* Skip "requires" tags */
-      if (!glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET))
+      if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+           glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
         continue;
 
       if ((widget = glade_widget_read (project, NULL, node, NULL)) != NULL)
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 1e4265c..fcbb5cd 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1169,9 +1169,10 @@ glade_property_write (GladeProperty * property,
   g_return_if_fail (GLADE_IS_PROPERTY (property));
   g_return_if_fail (node != NULL);
 
-  /* This code should work the same for <packing> and <widget> */
+  /* This code should work the same for <packing>, <widget> and <template> */
   if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
-        glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
+        glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* There can be a couple of reasons to forcefully save a property */
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 6dcddd8..d1f2242 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -160,6 +160,7 @@ struct _GladeWidgetPrivate {
                                   * since the objects copy may be invalid due to a rebuild.
                                   */
   guint              rebuilding : 1;
+  guint              composite : 1;
 };
 
 enum
@@ -193,6 +194,7 @@ enum
   PROP_TOPLEVEL_HEIGHT,
   PROP_SUPPORT_WARNING,
   PROP_VISIBLE,
+  PROP_COMPOSITE,
   N_PROPERTIES
 };
 
@@ -1094,6 +1096,9 @@ glade_widget_set_real_property (GObject * object,
       case PROP_TOPLEVEL_HEIGHT:
         widget->priv->height = g_value_get_int (value);
         break;
+    case PROP_COMPOSITE:
+        glade_widget_set_is_composite (widget, g_value_get_boolean (value));
+       break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1150,6 +1155,9 @@ glade_widget_get_real_property (GObject * object,
       case PROP_REASON:
         g_value_set_int (value, widget->priv->construct_reason);
         break;
+      case PROP_COMPOSITE:
+        g_value_set_boolean (value, glade_widget_get_is_composite (widget));
+       break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1306,6 +1314,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
                             _("Wether the widget is visible or not"),
                              FALSE, G_PARAM_READABLE);
 
+  properties[PROP_COMPOSITE] =
+       g_param_spec_boolean ("composite", _("Compisite"),
+                            _("Whether this widget is the template for a composite widget"),
+                            FALSE, G_PARAM_READWRITE);
+
   /* Install all properties */
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
 
@@ -2547,6 +2560,57 @@ glade_widget_get_name (GladeWidget * widget)
 }
 
 /**
+ * glade_widget_set_is_composite:
+ * @widget: a #GladeWidget
+ * @composite: whether @widget should be a composite template
+ *
+ * Set's this widget to be toplevel composite object to be
+ * eventually used with gtk_widget_class_set_template()
+ *
+ * Only one widget in a project should be composite.
+ */
+void
+glade_widget_set_is_composite (GladeWidget      *widget,
+                              gboolean          composite)
+{
+  g_return_if_fail (GLADE_IS_WIDGET (widget));
+
+  composite = !!composite;
+
+  if (widget->priv->composite != composite)
+    {
+      GladeProject *project = glade_widget_get_project (widget);
+
+      widget->priv->composite = composite;
+
+      g_object_notify_by_pspec (G_OBJECT (widget), properties[PROP_COMPOSITE]);
+
+      /* Update the project model when this changes */
+      if (widget->priv->parent == NULL &&
+         widget->priv->project != NULL &&
+         glade_project_has_object (widget->priv->project, widget->priv->object))
+       glade_project_widget_changed (project, widget);
+    }
+}
+
+/**
+ * glade_widget_get_is_composite:
+ * @widget: a #GladeWidget
+ *
+ * Checks if @widget is a composite template to be used
+ * with gtk_widget_class_set_template().
+ *
+ * Returns: whether @widget is composite.
+ */
+gboolean
+glade_widget_get_is_composite (GladeWidget *widget)
+{
+  g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
+
+  return widget->priv->composite;
+}
+
+/**
  * glade_widget_set_internal:
  * @widget: A #GladeWidget
  * @internal: The internal name
@@ -3747,13 +3811,18 @@ glade_widget_read (GladeProject * project,
 {
   GladeWidgetAdaptor *adaptor;
   GladeWidget *widget = NULL;
-  gchar *klass, *id;
+  gchar *klass, *id = NULL, *template_parent = NULL;
+  gboolean template = FALSE;
 
   if (glade_project_load_cancelled (project))
     return NULL;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
-    return NULL;
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
+      return NULL;
+
+  if (glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE))
+    template = TRUE;
 
   glade_widget_push_superuser ();
 
@@ -3761,15 +3830,25 @@ glade_widget_read (GladeProject * project,
        glade_xml_get_property_string_required
        (node, GLADE_XML_TAG_CLASS, NULL)) != NULL)
     {
-      if ((id =
-           glade_xml_get_property_string_required
-           (node, GLADE_XML_TAG_ID, NULL)) != NULL)
-        {
+      if (template)
+       {
+         template_parent = glade_xml_get_property_string_required (node, GLADE_TAG_PARENT, NULL);
+
+         if (template_parent)
+           id = g_strdup (klass);
+       }
+      else
+       id = glade_xml_get_property_string_required (node, GLADE_XML_TAG_ID, NULL);
+       
+      if (id)
+       {
           GType type;
+         const gchar *type_to_use = template_parent ? template_parent : klass;
+
           /* 
            * Create GladeWidget instance based on type. 
            */
-          if ((adaptor = glade_widget_adaptor_get_by_name (klass)) &&
+          if ((adaptor = glade_widget_adaptor_get_by_name (type_to_use)) &&
               (type = glade_widget_adaptor_get_object_type (adaptor)) &&
               G_TYPE_IS_INSTANTIATABLE (type) &&
               G_TYPE_IS_ABSTRACT (type) == FALSE)
@@ -3800,6 +3879,7 @@ glade_widget_read (GladeProject * project,
                   widget = glade_widget_adaptor_create_widget
                       (adaptor, FALSE,
                        "name", id,
+                      "composite", template,
                        "parent", parent,
                        "project", project, "reason", GLADE_CREATE_LOAD, NULL);
                 }
@@ -3816,6 +3896,7 @@ glade_widget_read (GladeProject * project,
               widget = glade_widget_adaptor_create_widget (glade_widget_adaptor_get_by_type 
(GTK_TYPE_WIDGET),
                                                            FALSE,
                                                            "parent", parent,
+                                                           "composite", template,
                                                            "project", project,
                                                            "reason", GLADE_CREATE_LOAD,
                                                            "object", stub,
@@ -3824,6 +3905,7 @@ glade_widget_read (GladeProject * project,
             }
           g_free (id);
         }
+      g_free (template_parent);
       g_free (klass);
     }
 
@@ -4020,15 +4102,28 @@ glade_widget_write (GladeWidget * widget,
       return;
     }
 
-  widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET);
-  glade_xml_node_append_child (node, widget_node);
-
   /* Set class and id */
-  glade_xml_node_set_property_string (widget_node,
-                                      GLADE_XML_TAG_CLASS,
-                                      glade_widget_adaptor_get_name (widget->priv->adaptor));
-  glade_xml_node_set_property_string (widget_node,
-                                      GLADE_XML_TAG_ID, widget->priv->name);
+  if (widget->priv->composite)
+    {
+      widget_node = glade_xml_node_new (context, GLADE_XML_TAG_TEMPLATE);
+      glade_xml_node_set_property_string (widget_node,
+                                         GLADE_XML_TAG_CLASS,
+                                         widget->priv->name);
+      glade_xml_node_set_property_string (widget_node,
+                                         GLADE_TAG_PARENT,
+                                         glade_widget_adaptor_get_name (widget->priv->adaptor));
+    }
+  else
+    {
+      widget_node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET);
+      glade_xml_node_set_property_string (widget_node,
+                                         GLADE_XML_TAG_CLASS,
+                                         glade_widget_adaptor_get_name (widget->priv->adaptor));
+      glade_xml_node_set_property_string (widget_node,
+                                         GLADE_XML_TAG_ID, widget->priv->name);
+    }
+
+  glade_xml_node_append_child (node, widget_node);
 
   /* Write out widget content (properties and signals) */
   glade_widget_adaptor_write_widget (widget->priv->adaptor, widget, context,
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index 0e19c2f..e44bb5e 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -339,6 +339,11 @@ void                    glade_widget_set_name                  (GladeWidget      *widget,
  
 G_CONST_RETURN gchar   *glade_widget_get_name               (GladeWidget      *widget);
 
+void                    glade_widget_set_is_composite       (GladeWidget      *widget,
+                                                            gboolean          composite);
+
+gboolean                glade_widget_get_is_composite       (GladeWidget      *widget);
+
 void                    glade_widget_set_internal          (GladeWidget      *widget,
                                                             const gchar      *internal);
  
diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h
index c7b116f..c4e6c1b 100644
--- a/gladeui/glade-xml-utils.h
+++ b/gladeui/glade-xml-utils.h
@@ -36,6 +36,7 @@ typedef struct _GladeProject        GladeProject;
 /* Used for catalog tags and attributes */
 #define GLADE_XML_TAG_PROJECT                     "interface"
 #define GLADE_XML_TAG_WIDGET                      "object"
+#define GLADE_XML_TAG_TEMPLATE                    "template"
 
 #define GLADE_XML_TAG_VERSION                     "version"
 #define GLADE_XML_TAG_REQUIRES                    "requires"
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 05869a4..e7c4d0d 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -410,7 +410,8 @@ void
 glade_gtk_widget_read_widget (GladeWidgetAdaptor * adaptor,
                               GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -686,7 +687,8 @@ glade_gtk_widget_write_widget (GladeWidgetAdaptor * adaptor,
 {
   GObject *obj;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* Make sure use-action-appearance and related-action properties are
@@ -801,8 +803,9 @@ glade_gtk_widget_deep_post_create (GladeWidgetAdaptor * adaptor,
     g_signal_connect (G_OBJECT (widget), "notify::parent",
                       G_CALLBACK (widget_parent_changed), adaptor);
 
-  if (!glade_widget_adaptor_get_book (adaptor) || !glade_util_have_devhelp ())
-    glade_widget_remove_action (gwidget, "read_documentation");
+  /* XXX WTF ?
+   * if (!glade_widget_adaptor_get_book (adaptor) || !glade_util_have_devhelp ()) */
+  /*   glade_widget_remove_action (gwidget, "read_documentation"); */
 }
 
 void
@@ -3405,7 +3408,8 @@ glade_gtk_entry_read_widget (GladeWidgetAdaptor * adaptor,
 {
   GladeProperty *property;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -3643,7 +3647,8 @@ void
 glade_gtk_window_read_widget (GladeWidgetAdaptor * adaptor,
                               GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -3689,7 +3694,8 @@ glade_gtk_window_write_widget (GladeWidgetAdaptor * adaptor,
                                GladeWidget * widget,
                                GladeXmlContext * context, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -4285,7 +4291,8 @@ void
 glade_gtk_button_read_widget (GladeWidgetAdaptor * adaptor,
                               GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -4303,7 +4310,8 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor,
   gboolean use_stock;
   gchar *stock = NULL;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* Do not save GtkColorButton GtkFontButton and GtkScaleButton label property */
@@ -4341,7 +4349,8 @@ glade_gtk_image_read_widget (GladeWidgetAdaptor * adaptor,
 {
   GladeProperty *property;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -4412,7 +4421,9 @@ glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
                               GladeWidget * widget,
                               GladeXmlContext * context, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and write all the normal properties (including "use-stock")... */
@@ -5546,7 +5557,8 @@ glade_gtk_image_menu_item_read_widget (GladeWidgetAdaptor * adaptor,
   gboolean use_stock;
   gchar *label = NULL;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -5585,7 +5597,8 @@ glade_gtk_image_menu_item_write_widget (GladeWidgetAdaptor * adaptor,
   gboolean use_stock;
   gchar *stock;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* Make a copy of the GladeProperty, override its value if use-stock is TRUE */
@@ -6040,7 +6053,8 @@ glade_gtk_toolbar_write_widget (GladeWidgetAdaptor * adaptor,
                                GladeWidget * widget,
                                GladeXmlContext * context, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and write all the normal properties (including "use-stock")... */
@@ -6305,7 +6319,8 @@ void
 glade_gtk_tool_item_group_read_widget (GladeWidgetAdaptor * adaptor,
                                       GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -6613,7 +6628,8 @@ void
 glade_gtk_tool_button_read_widget (GladeWidgetAdaptor * adaptor,
                                    GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -7099,7 +7115,9 @@ glade_gtk_label_read_widget (GladeWidgetAdaptor * adaptor,
                              GladeWidget * widget, GladeXmlNode * node)
 {
   GladeProperty *prop;
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -7185,7 +7203,8 @@ glade_gtk_label_write_widget (GladeWidgetAdaptor * adaptor,
 {
   GladeXmlNode *attrs_node;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -7626,7 +7645,8 @@ void
 glade_gtk_combo_box_text_read_widget (GladeWidgetAdaptor * adaptor,
                                      GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -7680,7 +7700,8 @@ glade_gtk_combo_box_text_write_widget (GladeWidgetAdaptor * adaptor,
 {
   GladeXmlNode *attrs_node;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -8210,7 +8231,8 @@ void
 glade_gtk_size_group_read_widget (GladeWidgetAdaptor * adaptor,
                                   GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -8258,7 +8280,8 @@ glade_gtk_size_group_write_widget (GladeWidgetAdaptor * adaptor,
                                    GladeXmlContext * context,
                                    GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -8449,7 +8472,8 @@ void
 glade_gtk_icon_factory_read_widget (GladeWidgetAdaptor * adaptor,
                                     GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in any normal properties.. */
@@ -8557,7 +8581,8 @@ glade_gtk_icon_factory_write_widget (GladeWidgetAdaptor * adaptor,
                                      GladeXmlContext * context,
                                      GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and write all the normal properties.. */
@@ -9237,7 +9262,8 @@ glade_gtk_store_write_widget (GladeWidgetAdaptor * adaptor,
                               GladeWidget * widget,
                               GladeXmlContext * context, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and write all the normal properties.. */
@@ -9443,7 +9469,8 @@ void
 glade_gtk_store_read_widget (GladeWidgetAdaptor * adaptor,
                              GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -9683,7 +9710,8 @@ glade_gtk_cell_renderer_write_widget (GladeWidgetAdaptor * adaptor,
                                       GladeXmlContext * context,
                                       GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* Write our normal properties, then chain up to write any other normal properties,
@@ -9739,7 +9767,8 @@ void
 glade_gtk_cell_renderer_read_widget (GladeWidgetAdaptor * adaptor,
                                      GladeWidget * widget, GladeXmlNode * node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the properties... */
@@ -10466,7 +10495,8 @@ glade_gtk_adjustment_write_widget (GladeWidgetAdaptor * adaptor,
 {
   GladeProperty *prop;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* Ensure proper order of adjustment properties by writing them here. */
@@ -11006,7 +11036,8 @@ glade_gtk_recent_filter_read_widget (GladeWidgetAdaptor *adaptor,
                                     GladeWidget        *widget, 
                                     GladeXmlNode       *node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -11025,7 +11056,8 @@ glade_gtk_recent_filter_write_widget (GladeWidgetAdaptor *adaptor,
 {
   GladeXmlNode *strings_node;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -11064,7 +11096,8 @@ glade_gtk_file_filter_read_widget (GladeWidgetAdaptor *adaptor,
                                   GladeWidget        *widget, 
                                   GladeXmlNode       *node)
 {
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */
@@ -11082,7 +11115,8 @@ glade_gtk_file_filter_write_widget (GladeWidgetAdaptor *adaptor,
 {
   GladeXmlNode *strings_node;
 
-  if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
+  if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
+       glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
     return;
 
   /* First chain up and read in all the normal properties.. */


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