[libgda/LIBGDA_5.0: 1/5] GdaConfig: sort providers by ID



commit 7a05efd643e2f473ae3620ea3bb2015330855067
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Dec 11 21:50:36 2011 +0100

    GdaConfig: sort providers by ID

 libgda/gda-config.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index 1d8c024..01d9f30 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -1476,7 +1476,13 @@ gda_config_list_providers (void)
 	GDA_CONFIG_UNLOCK ();
 	return model;
 }
- 
+
+static gint
+internal_provider_sort_func (InternalProvider *a, InternalProvider *b)
+{
+	return strcmp (a->pinfo.id, b->pinfo.id);
+}
+
 static void load_providers_from_dir (const gchar *dirname, gboolean recurs);
 static void
 load_all_providers (void)
@@ -1504,6 +1510,10 @@ load_all_providers (void)
 		_gda_config_sqlite_provider = (GdaServerProvider*) 
 			g_object_new (GDA_TYPE_SQLITE_PROVIDER, NULL);
 	}
+
+	/* sort providers by name */
+	unique_instance->priv->prov_list = g_slist_sort (unique_instance->priv->prov_list,
+							 (GCompareFunc) internal_provider_sort_func);
 }
 
 static InternalProvider *



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