[Xfce4-commits] [xfce/garcon] 01/01: Add case insensitive sorting to the menu (bug #10594).
noreply at xfce.org
noreply at xfce.org
Mon Jul 28 18:32:49 CEST 2014
This is an automated email from the git hooks/post-receive script.
nick pushed a commit to branch master
in repository xfce/garcon.
commit 65a793cf40a262b313803e37dcddeb509c1e5ae1
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jul 28 18:31:18 2014 +0200
Add case insensitive sorting to the menu (bug #10594).
The function is called multiple times for each element, so its
probably wise to cache the casefolded names at some point if it
turns out to be a performance issue.
---
garcon/garcon-menu.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/garcon/garcon-menu.c b/garcon/garcon-menu.c
index e23e268..ac7cdcc 100644
--- a/garcon/garcon-menu.c
+++ b/garcon/garcon-menu.c
@@ -1627,8 +1627,20 @@ static gint
garcon_menu_compare_items (gconstpointer *a,
gconstpointer *b)
{
- return g_utf8_collate (garcon_menu_element_get_name (GARCON_MENU_ELEMENT (a)),
- garcon_menu_element_get_name (GARCON_MENU_ELEMENT (b)));
+ gchar *casefold_a, *casefold_b;
+ gint result;
+
+ /* do case insensitive sorting, see bug #10594 */
+ /* TODO: this function is called often, maybe catch the casefolded name */
+ casefold_a = g_utf8_casefold (garcon_menu_element_get_name (GARCON_MENU_ELEMENT (a)), -1);
+ casefold_b = g_utf8_casefold (garcon_menu_element_get_name (GARCON_MENU_ELEMENT (b)), -1);
+
+ result = g_utf8_collate (casefold_a, casefold_b);
+
+ g_free (casefold_a);
+ g_free (casefold_b);
+
+ return result;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list