[libgda] GdaConfig: sort providers by ID



commit bcdf1fdcd3075391c637388f51c0d5dfed8148e3
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]