154 lines
3.7 KiB
Diff
154 lines
3.7 KiB
Diff
--- gdm-2.17.8/gui/gdmcommon.h.hide-uninstalled-languages 2007-03-09 12:30:58.000000000 -0500
|
|
+++ gdm-2.17.8/gui/gdmcommon.h 2007-03-09 12:31:59.000000000 -0500
|
|
@@ -67,5 +67,5 @@
|
|
void gdm_common_atspi_launch (void);
|
|
gchar* gdm_common_expand_text (const gchar *text);
|
|
gchar* gdm_common_get_clock (struct tm **the_tm);
|
|
-
|
|
+gboolean gdm_common_locale_is_displayable (const gchar *locale);
|
|
#endif /* GDM_COMMON_H */
|
|
--- 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 <sys/types.h>
|
|
#include <signal.h>
|
|
|
|
+#include <fontconfig/fontconfig.h>
|
|
+
|
|
#include <glib/gi18n.h>
|
|
#include <gdk/gdkx.h>
|
|
#include <gtk/gtk.h>
|
|
@@ -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:37:17.000000000 -0500
|
|
@@ -86,6 +86,11 @@
|
|
|
|
li->data = NULL;
|
|
|
|
+ if (!gdm_common_locale_is_displayable (lang)) {
|
|
+ g_free (lang);
|
|
+ continue;
|
|
+ }
|
|
+
|
|
name = gdm_lang_name (lang,
|
|
FALSE /* never_encoding */,
|
|
TRUE /* no_group */,
|