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



commit 136d455ea48accd8a5900e5c09259b8910c960e2
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    |   77 +++++++++++++++++++++++++++-------
 gladeui/glade-xml-utils.h |    1 +
 plugins/gtk+/glade-gtk.c  |  100 ++++++++++++++++++++++++++++++---------------
 5 files changed, 136 insertions(+), 53 deletions(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index b1c71e8..f79fbfa 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 08eb6de..be0198d 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1168,9 +1168,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;
 
   /* Skip properties that are default by original pspec default
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 8c94a87..d1ef037 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -80,6 +80,8 @@ struct _GladeWidgetPrivate {
                * used when loading widget with libglade
                */
 
+  gchar *template_parent; /* The name of the parent class in a widget template */
+
   gchar *support_warning; /* A warning message for version incompatabilities
                           * in this widget
                           */
@@ -193,6 +195,7 @@ enum
   PROP_TOPLEVEL_HEIGHT,
   PROP_SUPPORT_WARNING,
   PROP_VISIBLE,
+  PROP_TEMPLATE_PARENT,
   N_PROPERTIES
 };
 
@@ -1094,6 +1097,10 @@ glade_widget_set_real_property (GObject * object,
       case PROP_TOPLEVEL_HEIGHT:
         widget->priv->height = g_value_get_int (value);
         break;
+    case PROP_TEMPLATE_PARENT:
+        g_free (widget->priv->template_parent);
+        widget->priv->template_parent = g_value_dup_string (value);
+       break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1150,6 +1157,9 @@ glade_widget_get_real_property (GObject * object,
       case PROP_REASON:
         g_value_set_int (value, widget->priv->construct_reason);
         break;
+    case PROP_TEMPLATE_PARENT:
+        g_value_set_string (value, widget->priv->template_parent);
+       break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1306,6 +1316,11 @@ glade_widget_class_init (GladeWidgetClass * klass)
                             _("Wether the widget is visible or not"),
                              FALSE, G_PARAM_READABLE);
 
+  properties[PROP_TEMPLATE_PARENT] =
+       g_param_spec_string ("template-parent", _("Parent Name"),
+                            _("The name of the parent in a template definition"),
+                            NULL, G_PARAM_READWRITE);
+
   /* Install all properties */
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
 
@@ -3747,13 +3762,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 +3781,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 +3830,7 @@ glade_widget_read (GladeProject * project,
                   widget = glade_widget_adaptor_create_widget
                       (adaptor, FALSE,
                        "name", id,
+                      "template-parent", template_parent,
                        "parent", parent,
                        "project", project, "reason", GLADE_CREATE_LOAD, NULL);
                 }
@@ -3816,6 +3847,7 @@ glade_widget_read (GladeProject * project,
               widget = glade_widget_adaptor_create_widget (glade_widget_adaptor_get_by_type 
(GTK_TYPE_WIDGET),
                                                            FALSE,
                                                            "parent", parent,
+                                                           "template-parent", template_parent,
                                                            "project", project,
                                                            "reason", GLADE_CREATE_LOAD,
                                                            "object", stub,
@@ -3824,6 +3856,7 @@ glade_widget_read (GladeProject * project,
             }
           g_free (id);
         }
+      g_free (template_parent);
       g_free (klass);
     }
 
@@ -4020,15 +4053,27 @@ 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->template_parent != NULL)
+    {
+      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, widget->priv->template_parent);
+    }
+  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-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 62f266b..10677f7 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.. */
@@ -4273,7 +4279,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.. */
@@ -4291,7 +4298,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 */
@@ -4329,7 +4337,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.. */
@@ -4402,7 +4411,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")... */
@@ -5536,7 +5547,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.. */
@@ -5575,7 +5587,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 */
@@ -6030,7 +6043,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")... */
@@ -6295,7 +6309,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.. */
@@ -6603,7 +6618,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.. */
@@ -7089,7 +7105,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.. */
@@ -7175,7 +7193,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.. */
@@ -7616,7 +7635,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.. */
@@ -7670,7 +7690,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.. */
@@ -8200,7 +8221,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.. */
@@ -8248,7 +8270,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.. */
@@ -8439,7 +8462,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.. */
@@ -8547,7 +8571,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.. */
@@ -9227,7 +9252,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.. */
@@ -9433,7 +9459,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.. */
@@ -9673,7 +9700,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,
@@ -9729,7 +9757,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... */
@@ -10456,7 +10485,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. */
@@ -10996,7 +11026,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.. */
@@ -11015,7 +11046,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.. */
@@ -11054,7 +11086,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.. */
@@ -11072,7 +11105,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]