[libgda] GdaBrowser: sort tables in UI to declare FK
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] GdaBrowser: sort tables in UI to declare FK
- Date: Thu, 10 Feb 2011 19:30:20 +0000 (UTC)
commit 34c34110e0bb27e059d27e0cc56fe5833202af7c
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu Feb 10 20:28:48 2011 +0100
GdaBrowser: sort tables in UI to declare FK
tools/browser/common/fk-declare.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/tools/browser/common/fk-declare.c b/tools/browser/common/fk-declare.c
index 917dea7..0849efc 100644
--- a/tools/browser/common/fk-declare.c
+++ b/tools/browser/common/fk-declare.c
@@ -417,6 +417,23 @@ fk_declare_new (GtkWindow *parent, GdaMetaStruct *mstruct, GdaMetaTable *table)
return wid;
}
+static gint
+dbo_sort_func (GdaMetaDbObject *dbo1, GdaMetaDbObject *dbo2)
+{
+ const gchar *n1, *n2;
+ g_assert (dbo1);
+ g_assert (dbo2);
+ if (dbo1->obj_name[0] == '"')
+ n1 = dbo1->obj_name + 1;
+ else
+ n1 = dbo1->obj_name;
+ if (dbo2->obj_name[0] == '"')
+ n2 = dbo2->obj_name + 1;
+ else
+ n2 = dbo2->obj_name;
+ return strcmp (n2, n1);
+}
+
static GtkTreeModel *
create_tables_model (GdaMetaStruct *mstruct)
{
@@ -428,6 +445,7 @@ create_tables_model (GdaMetaStruct *mstruct)
schemas = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL, (GDestroyNotify) gtk_tree_row_reference_free);
all_dbo = gda_meta_struct_get_all_db_objects (mstruct);
+ all_dbo = g_slist_sort (all_dbo, (GCompareFunc) dbo_sort_func);
for (list = all_dbo; list; list = list->next) {
GdaMetaDbObject *dbo = GDA_META_DB_OBJECT (list->data);
GtkTreeIter iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]