[glade/composite-templates-new: 1/4] GladeWidget: Avoid overwriting packing property values while rebuilding.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/composite-templates-new: 1/4] GladeWidget: Avoid overwriting packing property values while rebuilding.
- Date: Sat, 30 Mar 2013 13:06:59 +0000 (UTC)
commit 4b4b88bc48320d87d60e6962a2662f4b4b9473c5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Mar 30 22:01:48 2013 +0900
GladeWidget: Avoid overwriting packing property values while rebuilding.
This touches sensitive code in the widget rebuilding process which
exists for the sake of setting construct properties at runtime.
gladeui/glade-widget.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index ba9c2b3..6bb76be 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -159,6 +159,7 @@ struct _GladeWidgetPrivate {
guint visible : 1; /* Local copy of widget visibility, we need to keep track of this
* since the objects copy may be invalid due to a rebuild.
*/
+ guint rebuilding : 1;
};
enum
@@ -2343,6 +2344,13 @@ glade_widget_rebuild (GladeWidget * gwidget)
g_return_if_fail (GLADE_IS_WIDGET (gwidget));
+ /* Mark the widget as currently rebuilding,
+ *
+ * We avoid rewriting and losing packing properties when
+ * reparenting in the process of rebuilding a widget instance
+ */
+ gwidget->priv->rebuilding = TRUE;
+
adaptor = gwidget->priv->adaptor;
if (gwidget->priv->parent &&
@@ -2485,6 +2493,9 @@ glade_widget_rebuild (GladeWidget * gwidget)
glade_widget_show (gwidget);
g_object_unref (gwidget);
+
+ gwidget->priv->rebuilding = FALSE;
+
}
/**
@@ -3543,6 +3554,12 @@ glade_widget_set_packing_properties (GladeWidget * widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (container));
+ /* Avoid rewriting and losing packing properties when
+ * reparenting in the process of rebuilding a widget instance.
+ */
+ if (widget->priv->rebuilding)
+ return;
+
g_list_foreach (widget->priv->packing_properties, (GFunc) g_object_unref, NULL);
g_list_free (widget->priv->packing_properties);
widget->priv->packing_properties = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]