[gnome-initial-setup] language-chooser: normalize, unaccent and casefold compared strings
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] language-chooser: normalize, unaccent and casefold compared strings
- Date: Thu, 26 Oct 2017 08:01:27 +0000 (UTC)
commit 6e83cf8e0fbcd7f8874fb6595bfa49b9ed9c97b2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jun 8 00:06:47 2016 -0300
language-chooser: normalize, unaccent and casefold compared strings
To further improve the sorting of the language chooser, lower cased,
accented and non-casefolded strings should be compared equally.
This patch makes the sorting function insensitive to these factors.
The code to do this already exists, unused, in the keyboard page,
so it has been moved to the language page.
https://bugzilla.gnome.org/show_bug.cgi?id=787513
gnome-initial-setup/pages/keyboard/Makefile.am | 1 -
.../pages/keyboard/cc-input-chooser.c | 1 -
gnome-initial-setup/pages/language/Makefile.am | 1 +
.../pages/language/cc-language-chooser.c | 7 ++-----
.../pages/{keyboard => language}/cc-util.c | 0
.../pages/{keyboard => language}/cc-util.h | 0
6 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/Makefile.am b/gnome-initial-setup/pages/keyboard/Makefile.am
index e7d74eb..05928ce 100644
--- a/gnome-initial-setup/pages/keyboard/Makefile.am
+++ b/gnome-initial-setup/pages/keyboard/Makefile.am
@@ -19,7 +19,6 @@ libgiskeyboard_la_SOURCES = \
cc-input-chooser.c cc-input-chooser.h \
cc-common-language.c cc-common-language.h \
cc-ibus-utils.c cc-ibus-utils.h \
- cc-util.c cc-util.h \
gis-keyboard-page.c gis-keyboard-page.h \
$(BUILT_SOURCES)
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index 964d88c..4ee2926 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -38,7 +38,6 @@
#endif
#include "cc-common-language.h"
-#include "cc-util.h"
#include <glib-object.h>
diff --git a/gnome-initial-setup/pages/language/Makefile.am b/gnome-initial-setup/pages/language/Makefile.am
index cca48f9..d87d87e 100644
--- a/gnome-initial-setup/pages/language/Makefile.am
+++ b/gnome-initial-setup/pages/language/Makefile.am
@@ -20,6 +20,7 @@ BUILT_SOURCES += language-resources.c language-resources.h
libgislanguage_la_SOURCES = \
cc-common-language.c cc-common-language.h \
cc-language-chooser.c cc-language-chooser.h \
+ cc-util.c cc-util.h \
gis-welcome-widget.c gis-welcome-widget.h \
gis-language-page.c gis-language-page.h \
$(BUILT_SOURCES)
diff --git a/gnome-initial-setup/pages/language/cc-language-chooser.c
b/gnome-initial-setup/pages/language/cc-language-chooser.c
index ee28d7e..2a6757a 100644
--- a/gnome-initial-setup/pages/language/cc-language-chooser.c
+++ b/gnome-initial-setup/pages/language/cc-language-chooser.c
@@ -33,6 +33,7 @@
#include <libgnome-desktop/gnome-languages.h>
#include "cc-common-language.h"
+#include "cc-util.h"
#include <glib-object.h>
@@ -123,7 +124,6 @@ language_widget_new (const char *locale_id,
gchar *language_name;
gchar *country = NULL;
gchar *country_name = NULL;
- gchar *sort_key;
LanguageWidget *widget = g_new0 (LanguageWidget, 1);
if (!gnome_parse_locale (locale_id, &language, &country, NULL, NULL))
@@ -170,10 +170,7 @@ language_widget_new (const char *locale_id,
widget->locale_current_name = locale_current_name;
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);
+ widget->sort_key = cc_util_normalize_casefold_and_unaccent (locale_name);
g_object_set_data_full (G_OBJECT (widget->box), "language-widget", widget,
language_widget_free);
diff --git a/gnome-initial-setup/pages/keyboard/cc-util.c b/gnome-initial-setup/pages/language/cc-util.c
similarity index 100%
rename from gnome-initial-setup/pages/keyboard/cc-util.c
rename to gnome-initial-setup/pages/language/cc-util.c
diff --git a/gnome-initial-setup/pages/keyboard/cc-util.h b/gnome-initial-setup/pages/language/cc-util.h
similarity index 100%
rename from gnome-initial-setup/pages/keyboard/cc-util.h
rename to gnome-initial-setup/pages/language/cc-util.h
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]