[glade] GladeWidget/GladeWidgetAdaptor: Added glade_widget_adaptor_write_widget_after()
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeWidget/GladeWidgetAdaptor: Added glade_widget_adaptor_write_widget_after()
- Date: Sat, 13 Apr 2013 17:50:53 +0000 (UTC)
commit f9194a7242918440082e6f3111fa8067aac0ed72
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Apr 13 20:30:37 2013 +0900
GladeWidget/GladeWidgetAdaptor: Added glade_widget_adaptor_write_widget_after()
This gives a chance to write content of a widget after children are written.
gladeui/glade-widget-adaptor.c | 39 +++++++++++++++++++++++++++++++++++++++
gladeui/glade-widget-adaptor.h | 10 +++++++---
gladeui/glade-widget.c | 3 +++
gladeui/glade-xml-utils.h | 1 +
4 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 1443763..6fa6e43 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -1102,6 +1102,15 @@ glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor *adaptor,
}
static void
+glade_widget_adaptor_object_write_widget_after (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlContext *context,
+ GladeXmlNode *node)
+{
+
+}
+
+static void
glade_widget_adaptor_object_read_child (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
GladeXmlNode *node)
@@ -1396,6 +1405,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
adaptor_class->depends = glade_widget_adaptor_object_depends;
adaptor_class->read_widget = glade_widget_adaptor_object_read_widget;
adaptor_class->write_widget = glade_widget_adaptor_object_write_widget;
+ adaptor_class->write_widget_after = glade_widget_adaptor_object_write_widget_after;
adaptor_class->read_child = glade_widget_adaptor_object_read_child;
adaptor_class->write_child = glade_widget_adaptor_object_write_child;
adaptor_class->create_eprop = glade_widget_adaptor_object_create_eprop;
@@ -1627,6 +1637,10 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass *klass,
klass->write_widget = symbol;
if (glade_xml_load_sym_from_node (node, module,
+ GLADE_TAG_WRITE_WIDGET_AFTER_FUNCTION, &symbol))
+ klass->write_widget_after = symbol;
+
+ if (glade_xml_load_sym_from_node (node, module,
GLADE_TAG_READ_CHILD_FUNCTION, &symbol))
klass->read_child = symbol;
@@ -4212,6 +4226,31 @@ glade_widget_adaptor_write_widget (GladeWidgetAdaptor *adaptor,
/**
+ * glade_widget_adaptor_write_widget_after:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @widget: The #GladeWidget
+ * @context: The #GladeXmlContext
+ * @node: The #GladeXmlNode
+ *
+ * This function is called to write @widget to @node
+ * when writing xml files (after writing children)
+ */
+void
+glade_widget_adaptor_write_widget_after (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlContext *context,
+ GladeXmlNode *node)
+{
+ g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
+ g_return_if_fail (GLADE_IS_WIDGET (widget));
+ g_return_if_fail (node != NULL);
+
+ GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->write_widget_after (adaptor, widget,
+ context, node);
+}
+
+
+/**
* glade_widget_adaptor_read_child:
* @adaptor: A #GladeWidgetAdaptor
* @widget: The #GladeWidget
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index 33a4866..8cb9c01 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -611,8 +611,6 @@ struct _GladeWidgetAdaptorClass
GladeConstructObjectFunc construct_object; /* Object constructor
*/
- GladeDestroyObjectFunc destroy_object; /* Object destructor */
-
GladePostCreateFunc deep_post_create; /* Executed after widget creation:
* plugins use this to setup various
* support codes (adaptors must always
@@ -682,6 +680,9 @@ struct _GladeWidgetAdaptorClass
GladeCreateEPropFunc create_eprop; /* Creates a GladeEditorProperty */
GladeStringFromValueFunc string_from_value; /* Creates a string for a value */
GladeCreateEditableFunc create_editable; /* Creates a page for the editor */
+
+ GladeDestroyObjectFunc destroy_object; /* Object destructor */
+ GladeWriteWidgetFunc write_widget_after;/* Writes widget attributes to the xml (after children) */
void (* glade_reserved1) (void);
void (* glade_reserved2) (void);
@@ -689,7 +690,6 @@ struct _GladeWidgetAdaptorClass
void (* glade_reserved4) (void);
void (* glade_reserved5) (void);
void (* glade_reserved6) (void);
- void (* glade_reserved7) (void);
};
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
@@ -843,6 +843,10 @@ void glade_widget_adaptor_write_widget (GladeWidgetAdapto
GladeWidget *widget,
GladeXmlContext *context,
GladeXmlNode *node);
+void glade_widget_adaptor_write_widget_after (GladeWidgetAdaptor *adaptor,
+ GladeWidget *widget,
+ GladeXmlContext *context,
+ GladeXmlNode *node);
void glade_widget_adaptor_read_child (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
GladeXmlNode *node);
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index ea732b6..5206c73 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -4170,6 +4170,9 @@ glade_widget_write (GladeWidget * widget,
}
g_list_free (list);
}
+
+ /* Write out trailing widget content (anything that goes after children) */
+ glade_widget_adaptor_write_widget_after (widget->priv->adaptor, widget, context, widget_node);
}
diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h
index 26031cf..c08f821 100644
--- a/gladeui/glade-xml-utils.h
+++ b/gladeui/glade-xml-utils.h
@@ -110,6 +110,7 @@ typedef struct _GladeProject GladeProject;
#define GLADE_TAG_DEPENDS_FUNCTION "depends-function"
#define GLADE_TAG_READ_WIDGET_FUNCTION "read-widget-function"
#define GLADE_TAG_WRITE_WIDGET_FUNCTION "write-widget-function"
+#define GLADE_TAG_WRITE_WIDGET_AFTER_FUNCTION "write-widget-after-function"
#define GLADE_TAG_READ_CHILD_FUNCTION "read-child-function"
#define GLADE_TAG_WRITE_CHILD_FUNCTION "write-child-function"
#define GLADE_TAG_CREATE_EPROP_FUNCTION "create-editor-property-function"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]