|
|
6941265 |
--- gdm-2.19.1/gui/gdmcommon.c.hide-uninstalled-languages 2007-05-13 22:08:15.000000000 -0400
|
|
|
6941265 |
+++ gdm-2.19.1/gui/gdmcommon.c 2007-05-21 13:24:20.000000000 -0400
|
|
|
6941265 |
@@ -32,6 +32,8 @@
|
|
|
7c71c5e |
#include <sys/types.h>
|
|
|
7c71c5e |
#include <signal.h>
|
|
|
7c71c5e |
|
|
|
7c71c5e |
+#include <fontconfig/fontconfig.h>
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
#include <glib/gi18n.h>
|
|
|
7c71c5e |
#include <gdk/gdkx.h>
|
|
|
7c71c5e |
#include <gtk/gtk.h>
|
|
|
6941265 |
@@ -928,3 +930,95 @@ gdm_common_expand_text (const gchar *tex
|
|
|
6941265 |
return g_string_free (str, FALSE);
|
|
|
7c71c5e |
}
|
|
|
7c71c5e |
|
|
|
7c71c5e |
+typedef enum
|
|
|
7c71c5e |
+{
|
|
|
7c71c5e |
+ LOCALE_UP_TO_LANGUAGE = 0,
|
|
|
7c71c5e |
+ LOCALE_UP_TO_COUNTRY,
|
|
|
7c71c5e |
+ LOCALE_UP_TO_ENCODING,
|
|
|
7c71c5e |
+ LOCALE_UP_TO_MODIFIER,
|
|
|
7c71c5e |
+} LocaleScope;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+static char *
|
|
|
7c71c5e |
+get_less_specific_locale (const char *locale,
|
|
|
7c71c5e |
+ LocaleScope scope)
|
|
|
7c71c5e |
+{
|
|
|
7c71c5e |
+ char *generalized_locale;
|
|
|
7c71c5e |
+ char *end;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ generalized_locale = strdup (locale);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ end = strchr (generalized_locale, '_');
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (end != NULL && scope <= LOCALE_UP_TO_LANGUAGE)
|
|
|
7c71c5e |
+ {
|
|
|
7c71c5e |
+ *end = '\0';
|
|
|
7c71c5e |
+ return generalized_locale;
|
|
|
7c71c5e |
+ }
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ end = strchr (generalized_locale, '.');
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (end != NULL && scope <= LOCALE_UP_TO_COUNTRY)
|
|
|
7c71c5e |
+ {
|
|
|
7c71c5e |
+ *end = '\0';
|
|
|
7c71c5e |
+ return generalized_locale;
|
|
|
7c71c5e |
+ }
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ end = strchr (generalized_locale, '@');
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (end != NULL && scope <= LOCALE_UP_TO_ENCODING)
|
|
|
7c71c5e |
+ {
|
|
|
7c71c5e |
+ *end = '\0';
|
|
|
7c71c5e |
+ return generalized_locale;
|
|
|
7c71c5e |
+ }
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ return generalized_locale;
|
|
|
7c71c5e |
+}
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+gboolean
|
|
|
7c71c5e |
+gdm_common_locale_is_displayable (const gchar *locale)
|
|
|
7c71c5e |
+{
|
|
|
7c71c5e |
+ char *language_code;
|
|
|
7c71c5e |
+ gboolean is_displayable;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ FcPattern *pattern;
|
|
|
7c71c5e |
+ FcObjectSet *object_set;
|
|
|
7c71c5e |
+ FcFontSet *font_set;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ is_displayable = FALSE;
|
|
|
7c71c5e |
+ pattern = NULL;
|
|
|
7c71c5e |
+ object_set = NULL;
|
|
|
7c71c5e |
+ font_set = NULL;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ language_code = get_less_specific_locale (locale, LOCALE_UP_TO_LANGUAGE);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ pattern = FcPatternBuild (NULL, FC_LANG, FcTypeString, language_code, NULL);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (pattern == NULL)
|
|
|
7c71c5e |
+ goto done;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ object_set = FcObjectSetBuild (NULL, NULL);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (object_set == NULL)
|
|
|
7c71c5e |
+ goto done;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ font_set = FcFontList (NULL, pattern, object_set);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (font_set == NULL)
|
|
|
7c71c5e |
+ goto done;
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ is_displayable = (font_set->nfont > 0);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+done:
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (font_set != NULL)
|
|
|
7c71c5e |
+ FcFontSetDestroy (font_set);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (object_set != NULL)
|
|
|
7c71c5e |
+ FcObjectSetDestroy (object_set);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ if (pattern != NULL)
|
|
|
7c71c5e |
+ FcPatternDestroy (pattern);
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
+ g_free (language_code);
|
|
|
7c71c5e |
+ return is_displayable;
|
|
|
7c71c5e |
+}
|
|
|
6941265 |
--- gdm-2.19.1/gui/gdmlanguages.c.hide-uninstalled-languages 2007-05-21 13:29:38.000000000 -0400
|
|
|
6941265 |
+++ gdm-2.19.1/gui/gdmlanguages.c 2007-05-21 13:30:28.000000000 -0400
|
|
|
6941265 |
@@ -705,6 +705,11 @@ gdm_lang_initialize_model (gchar * local
|
|
|
7c71c5e |
|
|
|
7c71c5e |
li->data = NULL;
|
|
|
7c71c5e |
|
|
|
d3c1b09 |
+ if (!gdm_common_locale_is_displayable (lang)) {
|
|
|
6941265 |
+ g_free (lang);
|
|
|
6941265 |
+ continue;
|
|
|
7c71c5e |
+ }
|
|
|
7c71c5e |
+
|
|
|
7c71c5e |
name = gdm_lang_name (lang,
|
|
|
7c71c5e |
FALSE /* never_encoding */,
|
|
|
7c71c5e |
TRUE /* no_group */,
|
|
|
6941265 |
--- gdm-2.19.1/gui/gdmcommon.h.hide-uninstalled-languages 2007-05-13 22:08:15.000000000 -0400
|
|
|
6941265 |
+++ gdm-2.19.1/gui/gdmcommon.h 2007-05-21 13:24:20.000000000 -0400
|
|
|
6941265 |
@@ -70,5 +70,5 @@ void gdm_common_pre_fetch_launch
|
|
|
6941265 |
void gdm_common_atspi_launch (void);
|
|
|
6941265 |
gchar* gdm_common_expand_text (const gchar *text);
|
|
|
6941265 |
gchar* gdm_common_get_clock (struct tm **the_tm);
|
|
|
6941265 |
-
|
|
|
6941265 |
+gboolean gdm_common_locale_is_displayable (const gchar *locale);
|
|
|
6941265 |
#endif /* GDM_COMMON_H */
|