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



commit 1436358135254e75581bac18615f8d7a274450e5
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 |   28 +++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 80675f9..8ef11cc 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-10-04  Juan Pablo Ugarte <juanpablougarte gmail com>
 
         * gladeui/glade-previewer.c:
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index f3191f8..87d31ee 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -959,7 +959,33 @@ glade_widget_adaptor_object_depends (GladeWidgetAdaptor * adaptor,
                                      GladeWidget * widget,
                                      GladeWidget * another)
 {
-  return FALSE;
+  GList   *prop_refs, *l;
+  gboolean depends = FALSE;
+
+  prop_refs = glade_widget_list_prop_refs (another);
+
+  for (l = prop_refs; !depends && l; l = l->next)
+    {
+      GladeProperty *property = l->data;
+      GladeWidget   *prop_widget = glade_property_get_widget (property);
+
+      /* 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;
+    }
+
+  g_list_free (prop_refs);
+
+  return depends;
 }
 
 static void



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