diff options
author | Christophe Fergeau <teuf@gnome.org> | 2004-06-02 02:57:42 +0800 |
---|---|---|
committer | Christophe Fergeau <teuf@src.gnome.org> | 2004-06-02 02:57:42 +0800 |
commit | 84904a536d5ea05aaea46788b5e6b84070c7dc09 (patch) | |
tree | e52230efc1e5ebb3436635eff1bcc58136959cb1 | |
parent | df3e72dce330617d941f3ef381fae2444d478cc6 (diff) | |
download | gsoc2013-evolution-84904a536d5ea05aaea46788b5e6b84070c7dc09.tar.gz gsoc2013-evolution-84904a536d5ea05aaea46788b5e6b84070c7dc09.tar.zst gsoc2013-evolution-84904a536d5ea05aaea46788b5e6b84070c7dc09.zip |
sort the various available importer plugins by name in the importer druid
2004-06-01 Christophe Fergeau <teuf@gnome.org>
* e-shell-importer.c: sort the various available importer plugins by
name in the importer druid combo box so that the list doesn't change
from one evolution run to another.
svn path=/trunk/; revision=26148
-rw-r--r-- | shell/ChangeLog | 6 | ||||
-rw-r--r-- | shell/e-shell-importer.c | 28 |
2 files changed, 34 insertions, 0 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index e6ffc3181a..03da33a026 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2004-06-01 Christophe Fergeau <teuf@gnome.org> + + * e-shell-importer.c: sort the various available importer plugins by + name in the importer druid combo box so that the list doesn't change + from one evolution run to another. + 2004-05-27 Not Zed <NotZed@Ximian.com> ** See #58827. diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 373af53a8d..4357012075 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -536,6 +536,27 @@ item_selected (GtkWidget *item, data->choosen_iid = g_strdup (iid); } +static int +compare_info_name (const void *data1, const void *data2) +{ + const Bonobo_ServerInfo *info1 = (Bonobo_ServerInfo *)data1; + const Bonobo_ServerInfo *info2 = (Bonobo_ServerInfo *)data2; + const char *name1 = get_name_from_component_info (info1); + const char *name2 = get_name_from_component_info (info2); + + /* If we can't find a name for a plug-in, its iid will be used + * for display. Put such plug-ins at the end of the list since + * their displayed name won't be really user-friendly + */ + if (name1 == NULL) { + return -1; + } + if (name2 == NULL) { + return 1; + } + return g_utf8_collate (name1, name2); +} + static GtkWidget * create_plugin_menu (ImportData *data) { @@ -552,6 +573,13 @@ create_plugin_menu (ImportData *data) CORBA_exception_init (&ev); info_list = bonobo_activation_query (IMPORTER_REPO_ID_QUERY, NULL, &ev); + /* Sort info list to get a consistent ordering of the items in the + * combo box from one run of evolution to another. + */ + qsort (info_list->_buffer, info_list->_length, + sizeof (Bonobo_ServerInfo), + compare_info_name); + for (i = 0; i < info_list->_length; i++) { const Bonobo_ServerInfo *info; char *name = NULL; |