[gnome-initial-setup] Sort languages case-insensitively
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Sort languages case-insensitively
- Date: Tue, 22 Sep 2015 03:27:43 +0000 (UTC)
commit c9b8a8c718838c3357e456f9e8b9396efd96e717
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 18 15:11:59 2015 -0400
Sort languages case-insensitively
The current case-sensitive sorting is confusing.
https://bugzilla.gnome.org/show_bug.cgi?id=755233
.../pages/language/cc-language-chooser.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.c
b/gnome-initial-setup/pages/language/cc-language-chooser.c
index 222762b..bcc27f3 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.c
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.c
@@ -75,6 +75,7 @@ typedef struct {
gchar *locale_name;
gchar *locale_current_name;
gchar *locale_untranslated_name;
+ gchar *sort_key;
gboolean is_extra;
} LanguageWidget;
@@ -108,6 +109,7 @@ language_widget_free (gpointer data)
g_free (widget->locale_name);
g_free (widget->locale_current_name);
g_free (widget->locale_untranslated_name);
+ g_free (widget->sort_key);
g_free (widget);
}
@@ -119,6 +121,7 @@ language_widget_new (const char *locale_id,
gchar *locale_name, *locale_current_name, *locale_untranslated_name;
gchar *language, *language_name;
gchar *country, *country_name;
+ gchar *sort_key;
LanguageWidget *widget = g_new0 (LanguageWidget, 1);
if (!gnome_parse_locale (locale_id, &language, &country, NULL, NULL))
@@ -162,6 +165,10 @@ language_widget_new (const char *locale_id,
widget->locale_untranslated_name = locale_untranslated_name;
widget->is_extra = is_extra;
+ sort_key = g_utf8_normalize (locale_name, -1, G_NORMALIZE_DEFAULT);
+ widget->sort_key = g_utf8_casefold (sort_key, -1);
+ g_free (sort_key);
+
g_object_set_data_full (G_OBJECT (widget->box), "language-widget", widget,
language_widget_free);
@@ -354,7 +361,7 @@ sort_languages (GtkListBoxRow *a,
if (!la->is_extra && lb->is_extra)
return -1;
- return strcmp (la->locale_name, lb->locale_name);
+ return strcmp (la->sort_key, lb->sort_key);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]