[libgda] GdaBrowser: fixed a bug in the DataSource sorting



commit 7affde5764ab8426b7221b6d9dcea5f15307ac3c
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Mar 31 21:24:52 2010 +0200

    GdaBrowser: fixed a bug in the DataSource sorting

 tools/browser/data-manager/spec-editor.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tools/browser/data-manager/spec-editor.c b/tools/browser/data-manager/spec-editor.c
index 9055ebd..abf7964 100644
--- a/tools/browser/data-manager/spec-editor.c
+++ b/tools/browser/data-manager/spec-editor.c
@@ -532,6 +532,17 @@ create_sources_array (GSList *sources_list, GError **error)
 	return array;
 }
 
+static gint
+data_source_compare_func (DataSource *s1, DataSource *s2)
+{
+	if (source_depends_on (s1, s2))
+		return 1;
+	else if (source_depends_on (s2, s1))
+		return -1;
+	else
+		return 0;
+}
+
 static GSList *
 compute_sources_list (SpecEditor *sped, GError **error)
 {
@@ -577,7 +588,7 @@ compute_sources_list (SpecEditor *sped, GError **error)
 	}
 	xmlFreeDoc (doc);
 	doc = NULL;
-	return g_slist_reverse (sources_list);
+	return g_slist_sort (sources_list, (GCompareFunc) data_source_compare_func);
 
  onerror:
 	if (doc)



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