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



commit 571fae0ec017dcd7839d0bff0957b77aa8a69649
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  |   95 +++++++++++++++++++++++-----------
 6 files changed, 188 insertions(+), 51 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 33bd9b0..8e69f8d 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 28e0a62..89466df 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
@@ -2921,7 +2923,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.. */
@@ -3161,7 +3164,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.. */
@@ -3207,7 +3211,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.. */
@@ -3803,7 +3808,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.. */
@@ -3821,7 +3827,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 */
@@ -3859,7 +3866,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.. */
@@ -3930,7 +3938,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")... */
@@ -5064,7 +5074,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.. */
@@ -5103,7 +5114,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 */
@@ -5558,7 +5570,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")... */
@@ -5823,7 +5836,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.. */
@@ -6131,7 +6145,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.. */
@@ -6617,7 +6632,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.. */
@@ -6703,7 +6720,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.. */
@@ -7144,7 +7162,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.. */
@@ -7198,7 +7217,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.. */
@@ -7728,7 +7748,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.. */
@@ -7776,7 +7797,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.. */
@@ -7967,7 +7989,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.. */
@@ -8075,7 +8098,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.. */
@@ -8755,7 +8779,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.. */
@@ -8961,7 +8986,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.. */
@@ -9201,7 +9227,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,
@@ -9257,7 +9284,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... */
@@ -9984,7 +10012,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. */
@@ -10524,7 +10553,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.. */
@@ -10543,7 +10573,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.. */
@@ -10582,7 +10613,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.. */
@@ -10600,7 +10632,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]