summaryrefslogtreecommitdiff
path: root/gladeui/glade-widget-adaptor.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2013-04-06 15:37:22 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2013-04-06 15:44:27 +0900
commitaf4ff2a61ff6f3c70dffd91e4b37dc2d326851ec (patch)
tree40a5397c3ec07022f56d044f347f22e1c5589890 /gladeui/glade-widget-adaptor.c
parentd5a2961ae77ce23aedcf92da2935ba9bfd4c8de1 (diff)
downloadglade-af4ff2a61ff6f3c70dffd91e4b37dc2d326851ec.tar.gz
Added GladeWidgetAdaptor destroy_object method.
The destroy_object method gives the chance to plugins to undo anything which might have added a reference to the object.
Diffstat (limited to 'gladeui/glade-widget-adaptor.c')
-rw-r--r--gladeui/glade-widget-adaptor.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 1d7d1726..14437631 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -898,6 +898,13 @@ glade_widget_adaptor_object_construct_object (GladeWidgetAdaptor *adaptor,
return g_object_newv (adaptor->priv->type, n_parameters, parameters);
}
+static void
+glade_widget_adaptor_object_destroy_object (GladeWidgetAdaptor *adaptor,
+ GObject *object)
+{
+ /* Do nothing, just have a method here incase classes chain up */
+}
+
static GObject *
glade_widget_adaptor_object_get_internal_child (GladeWidgetAdaptor *adaptor,
@@ -1369,6 +1376,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
/* Class methods */
adaptor_class->create_widget = glade_widget_adaptor_object_create_widget;
adaptor_class->construct_object = glade_widget_adaptor_object_construct_object;
+ adaptor_class->destroy_object = glade_widget_adaptor_object_destroy_object;
adaptor_class->deep_post_create = NULL;
adaptor_class->post_create = NULL;
adaptor_class->get_internal_child = glade_widget_adaptor_object_get_internal_child;
@@ -1530,6 +1538,11 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass *klass,
klass->construct_object = symbol;
if (glade_xml_load_sym_from_node (node, module,
+ GLADE_TAG_DESTROY_OBJECT_FUNCTION,
+ &symbol))
+ klass->destroy_object = symbol;
+
+ if (glade_xml_load_sym_from_node (node, module,
GLADE_TAG_DEEP_POST_CREATE_FUNCTION,
&symbol))
klass->deep_post_create = symbol;
@@ -3238,6 +3251,22 @@ glade_widget_adaptor_construct_object (GladeWidgetAdaptor *adaptor,
parameters);
}
+/**
+ * glade_widget_adaptor_destroy_object:
+ * @adaptor: A #GladeWidgetAdaptor
+ * @object: The object to destroy
+ *
+ * This function is called to destroy a GObject instance.
+ */
+void
+glade_widget_adaptor_destroy_object (GladeWidgetAdaptor *adaptor,
+ GObject *object)
+{
+ g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
+
+ GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->destroy_object (adaptor, object);
+}
+
static void
gwa_internal_children_create (GladeWidgetAdaptor *adaptor,
GObject *parent_object,