[gnome-calendar/gnome-3-24] edit-dialog: sort the list of calendars in alphabetical order
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/gnome-3-24] edit-dialog: sort the list of calendars in alphabetical order
- Date: Mon, 24 Apr 2017 13:22:24 +0000 (UTC)
commit fef632d478a1737e005c60426fd03e25e766c2cb
Author: Evgeny Shulgin <izarizar mail ru>
Date: Thu Apr 20 19:26:12 2017 +0300
edit-dialog: sort the list of calendars in alphabetical order
Since gcal_manager_get_sources() returns a GList of ESource received
from the hash table, they are not sorted alphabetically. Because of
this, edit-dialog shows the unsorted list.
I added a function for sorting this GList that is case-insensitive.
https://bugzilla.gnome.org/show_bug.cgi?id=781231
src/gcal-edit-dialog.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 59fc74a..289b2e2 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -136,6 +136,18 @@ const GActionEntry action_entries[] =
{ "select-calendar", on_calendar_selected, "s" },
};
+static gint
+sources_menu_sort_func (gconstpointer a,
+ gconstpointer b)
+{
+ ESource *source1, *source2;
+
+ source1 = E_SOURCE (a);
+ source2 = E_SOURCE (b);
+
+ return g_ascii_strcasecmp (e_source_get_display_name (source1), e_source_get_display_name (source2));
+}
+
static void
fill_sources_menu (GcalEditDialog *dialog)
{
@@ -148,6 +160,8 @@ fill_sources_menu (GcalEditDialog *dialog)
list = gcal_manager_get_sources (dialog->manager);
dialog->sources_menu = g_menu_new ();
+ g_list_sort (list, sources_menu_sort_func);
+
for (aux = list; aux != NULL; aux = aux->next)
{
ESource *source;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]