Commit f9194a72 authored by Tristan Van Berkom's avatar Tristan Van Berkom

GladeWidget/GladeWidgetAdaptor: Added glade_widget_adaptor_write_widget_after()

This gives a chance to write content of a widget after children are written.
parent e13581f6
......@@ -1101,6 +1101,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,
......@@ -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;
......@@ -1626,6 +1636,10 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass *klass,
GLADE_TAG_WRITE_WIDGET_FUNCTION, &symbol))
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;
......@@ -4211,6 +4225,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
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment