[glade/glade-3-8] * gladeui/glade-widget-adaptor.c: Implemented a generic ->depends() routine to ensure that liststo



commit 653d02e29030137873b37851ae617bebd46fc439
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Oct 6 16:30:55 2011 -0400

    	* gladeui/glade-widget-adaptor.c: Implemented a generic ->depends() routine
    	to ensure that liststores are serialized before treemodelfilters which refer to them.

 ChangeLog                      |    5 +++++
 gladeui/glade-widget-adaptor.c |   24 +++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f459309..6567485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-06  Tristan Van Berkom <tvb gnome org>
+
+	* gladeui/glade-widget-adaptor.c: Implemented a generic ->depends() routine
+	to ensure that liststores are serialized before treemodelfilters which refer to them (bug 657164).
+
 2011-04-29  Javier JardÃn <jjardon gnome org>
 
 	* gladeui/glade-utils.c: Correctly detect the required devhelp version
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 7b352c4..6777e18 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -862,7 +862,29 @@ glade_widget_adaptor_object_depends (GladeWidgetAdaptor *adaptor,
 				     GladeWidget        *widget,
 				     GladeWidget        *another)
 {
-	return FALSE;
+	gboolean depends = FALSE;
+	GList   *l;
+
+	for (l = another->prop_refs; !depends && l; l = l->next)
+	{
+		GladeProperty *property = l->data;
+		GladeWidget   *prop_widget = property->widget;
+
+		/* If one of the properties that reference @another is
+		 * owned by @widget then @widget depends on @another
+		 */
+		if (prop_widget == widget)
+			depends = TRUE;
+
+		/* Or if the widget that owns a property which references
+		 * @another is somewhere inside @widget... then @widget
+		 * also depends on @another.
+		 */
+		else if (glade_widget_is_ancestor (prop_widget, widget))
+			depends = TRUE;
+	}
+
+	return depends;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]