From 7c71c5ede9c60fa7faa084b24df0333827fd8853 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mar 09 2007 17:24:57 +0000 Subject: - hide langauges that aren't displayable from the list (bug 206048) --- diff --git a/gdm-2.17.8-hide-uninstalled-languages.patch b/gdm-2.17.8-hide-uninstalled-languages.patch new file mode 100644 index 0000000..f442723 --- /dev/null +++ b/gdm-2.17.8-hide-uninstalled-languages.patch @@ -0,0 +1,144 @@ +--- gdm-2.17.8/gui/gdmlogin.c.hide-uninstalled-languages 2007-03-09 12:22:36.000000000 -0500 ++++ gdm-2.17.8/gui/gdmlogin.c 2007-03-09 12:22:39.000000000 -0500 +@@ -1192,6 +1192,11 @@ + + li->data = NULL; + ++ if (!gdm_common_locale_is_displayable (lang)) { ++ g_free (lang); ++ continue; ++ } ++ + group = name = gdm_lang_name (lang, + FALSE /* never_encoding */, + FALSE /* no_group */, +@@ -1202,6 +1207,8 @@ + continue; + } + ++ ++ + untranslated = gdm_lang_untranslated_name (lang, + TRUE /* markup */); + +--- gdm-2.17.8/gui/gdmcommon.c.hide-uninstalled-languages 2007-02-26 03:59:31.000000000 -0500 ++++ gdm-2.17.8/gui/gdmcommon.c 2007-03-09 12:21:29.000000000 -0500 +@@ -33,6 +33,8 @@ + #include + #include + ++#include ++ + #include + #include + #include +@@ -843,3 +845,95 @@ + return g_string_free (str, FALSE); + } + ++typedef enum ++{ ++ LOCALE_UP_TO_LANGUAGE = 0, ++ LOCALE_UP_TO_COUNTRY, ++ LOCALE_UP_TO_ENCODING, ++ LOCALE_UP_TO_MODIFIER, ++} LocaleScope; ++ ++static char * ++get_less_specific_locale (const char *locale, ++ LocaleScope scope) ++{ ++ char *generalized_locale; ++ char *end; ++ ++ generalized_locale = strdup (locale); ++ ++ end = strchr (generalized_locale, '_'); ++ ++ if (end != NULL && scope <= LOCALE_UP_TO_LANGUAGE) ++ { ++ *end = '\0'; ++ return generalized_locale; ++ } ++ ++ end = strchr (generalized_locale, '.'); ++ ++ if (end != NULL && scope <= LOCALE_UP_TO_COUNTRY) ++ { ++ *end = '\0'; ++ return generalized_locale; ++ } ++ ++ end = strchr (generalized_locale, '@'); ++ ++ if (end != NULL && scope <= LOCALE_UP_TO_ENCODING) ++ { ++ *end = '\0'; ++ return generalized_locale; ++ } ++ ++ return generalized_locale; ++} ++ ++gboolean ++gdm_common_locale_is_displayable (const gchar *locale) ++{ ++ char *language_code; ++ gboolean is_displayable; ++ ++ FcPattern *pattern; ++ FcObjectSet *object_set; ++ FcFontSet *font_set; ++ ++ is_displayable = FALSE; ++ pattern = NULL; ++ object_set = NULL; ++ font_set = NULL; ++ ++ language_code = get_less_specific_locale (locale, LOCALE_UP_TO_LANGUAGE); ++ ++ pattern = FcPatternBuild (NULL, FC_LANG, FcTypeString, language_code, NULL); ++ ++ if (pattern == NULL) ++ goto done; ++ ++ object_set = FcObjectSetBuild (NULL, NULL); ++ ++ if (object_set == NULL) ++ goto done; ++ ++ font_set = FcFontList (NULL, pattern, object_set); ++ ++ if (font_set == NULL) ++ goto done; ++ ++ is_displayable = (font_set->nfont > 0); ++ ++done: ++ ++ if (font_set != NULL) ++ FcFontSetDestroy (font_set); ++ ++ if (object_set != NULL) ++ FcObjectSetDestroy (object_set); ++ ++ if (pattern != NULL) ++ FcPatternDestroy (pattern); ++ ++ g_free (language_code); ++ return is_displayable; ++} +--- gdm-2.17.8/gui/greeter/greeter_action_language.c.hide-uninstalled-languages 2007-02-26 03:59:30.000000000 -0500 ++++ gdm-2.17.8/gui/greeter/greeter_action_language.c 2007-03-09 12:21:29.000000000 -0500 +@@ -86,6 +86,11 @@ + + li->data = NULL; + ++ if (!gdm_common_language_is_displayable (lang)) { ++ g_free (lang); ++ continue; ++ } ++ + name = gdm_lang_name (lang, + FALSE /* never_encoding */, + TRUE /* no_group */, diff --git a/gdm.spec b/gdm.spec index 8fd277f..92a86dd 100644 --- a/gdm.spec +++ b/gdm.spec @@ -16,7 +16,7 @@ Summary: The GNOME Display Manager Name: gdm Version: 2.17.8 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 License: LGPL/GPL Group: User Interface/X @@ -56,6 +56,9 @@ Patch29: gdm-2.17.7-greeter.patch Patch30: gdm-2.17.7-user-list-keynav.patch +Patch31: gdm-2.17.8-hide-uninstalled-languages.patch + + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Prereq: /usr/sbin/useradd @@ -129,6 +132,7 @@ several different X sessions on your local machine at the same time. %patch28 -p1 -b .desensitize-entry %patch29 -p0 -b .greeter %patch30 -p1 -b .keynav +%patch31 -p1 -b .hide-uninstalled-languages %build cp -f %{SOURCE1} config/gdm @@ -330,6 +334,9 @@ fi %attr(1770, root, gdm) %dir %{_localstatedir}/gdm %changelog +* Fri Mar 9 2007 Ray Strode - 1:2.17.8-3 +- hide langauges that aren't displayable from the list (bug 206048) + * Tue Mar 6 2007 Ray Strode - 1:2.17.8-2 - turn off pam sanity check because it conflicts with audit