gdm r6555 - in trunk: . gui/simple-greeter



Author: halfline
Date: Wed Oct  1 14:35:32 2008
New Revision: 6555
URL: http://svn.gnome.org/viewvc/gdm?rev=6555&view=rev

Log:
2008-10-01  Ray Strode <rstrode redhat com>

	* gui/simple-greeter/gdm-languages.c
	(make_codeset_canonical_for_locale),
	(gdm_normalize_language_name):
	change codeset in locale to follow canonical
	form so we end up with ".UTF-8" instead of
	".utf8" etc.


Modified:
   trunk/ChangeLog
   trunk/gui/simple-greeter/gdm-languages.c

Modified: trunk/gui/simple-greeter/gdm-languages.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-languages.c	(original)
+++ trunk/gui/simple-greeter/gdm-languages.c	Wed Oct  1 14:35:32 2008
@@ -216,6 +216,25 @@
         return name;
 }
 
+static void
+make_codeset_canonical_for_locale (const       *name,
+                                   const char **codeset)
+{
+        char *old_locale;
+        char *canonical_codeset;
+
+        old_locale = setlocale (LC_CTYPE, name);
+
+        if (old_locale == NULL) {
+                return;
+        }
+
+        g_free (*codeset);
+        *codeset = g_strdup (nl_langinfo (CODESET));
+
+        setlocale (LC_CTYPE, old_locale);
+}
+
 char *
 gdm_normalize_language_name (const char *name)
 {
@@ -234,6 +253,10 @@
                                  &territory_code,
                                  &codeset, &modifier);
 
+        if (codeset != NULL) {
+                make_codeset_canonical_for_locale (name, &codeset);
+        }
+
         normalized_name = construct_language_name (language_code,
                                                    territory_code,
                                                    codeset, modifier);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]