[frogr] Compare properties when reordering in a case insensitive way
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Compare properties when reordering in a case insensitive way
- Date: Wed, 25 May 2011 16:48:37 +0000 (UTC)
commit ec626a0ad61586f12be5df21a4e54539301b3656
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Wed May 25 18:45:14 2011 +0200
Compare properties when reordering in a case insensitive way
src/frogr-main-view-model.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/frogr-main-view-model.c b/src/frogr-main-view-model.c
index 17a8ca8..43bfbe2 100644
--- a/src/frogr-main-view-model.c
+++ b/src/frogr-main-view-model.c
@@ -99,7 +99,20 @@ _compare_pictures_by_property (FrogrPicture *p1, FrogrPicture *p2,
else if (G_VALUE_HOLDS_LONG (&value1))
result = g_value_get_long (&value1) - g_value_get_long (&value2);
else if (G_VALUE_HOLDS_STRING (&value1))
- result = g_strcmp0 (g_value_get_string (&value1), g_value_get_string (&value2));
+ {
+ gchar *str1 = NULL;
+ gchar *str2 = NULL;
+
+ /* Comparison of strings require some additional work to take
+ into account the different rules for each locale */
+ str1 = g_utf8_casefold (g_value_get_string (&value1), -1);
+ str2 = g_utf8_casefold (g_value_get_string (&value2), -1);
+
+ result = g_utf8_collate (str1, str2);
+
+ g_free (str1);
+ g_free (str2);
+ }
else
g_warning ("Unsupported type for property used for sorting");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]