1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-07-11 22:39:16 -04:00
ports/x11/lightdm/files/patch-liblightdm-gobject_language.c
Guido Falsi 23a47f28de x11/lightdm: Fix login.conf issues, import various improvements
- Add patch to use setusercontext(3) to setup user environment, so it respects login.conf among other things [1]
- Use autoreconf, since patch requires regenerating configure script to check for setusercontext(3) [2]
- Explicitly disable libaudit support, not supported in FreeBSD [3]
- Add QT5 options, disabled by default, to control linking against qt5 [4]
- Import patch adding option to enable alternative location for .xsession-errors file [5]
- Correctly define runtime dependencies
- Forcibly disable installation of apparmor files
- Install PAM configuration files as samples, so in the future they are not overwritten if customized
- Pet portclippy/portfmt
- Regenerate patches

Upstreaming:

[1] https://github.com/canonical/lightdm/pull/334

[5] https://github.com/canonical/lightdm/pull/335

Many thanks to all people involved!

PR:		266532 [1] [2],
		273720 [1],
		275885 [3] [4] [5]
Tested by:	Ivan Rozhuk <rozhuk.im@gmail.com>,
		Daniel Tameling <tamelingdaniel@gmail.com> (provided setusercontext patch),
		Anton Saietskii <vsasjason@gmail.com>
2023-12-29 19:25:15 +01:00

82 lines
2.8 KiB
C

https://bugs.launchpad.net/lightdm/+bug/790186
--- liblightdm-gobject/language.c.orig 2021-02-15 22:06:28 UTC
+++ liblightdm-gobject/language.c
@@ -55,6 +55,12 @@ static GList *languages = NULL;
static gboolean have_languages = FALSE;
static GList *languages = NULL;
+static gboolean
+is_utf8 (const gchar *code)
+{
+ return g_strrstr (code, ".utf8") || g_strrstr (code, ".UTF-8");
+}
+
static void
update_languages (void)
{
@@ -81,7 +87,7 @@ update_languages (void)
continue;
/* Ignore the non-interesting languages */
- if (strcmp (command, "locale -a") == 0 && !g_strrstr (code, ".utf8"))
+ if (strcmp (command, "locale -a") == 0 && !is_utf8 (code))
continue;
LightDMLanguage *language = g_object_new (LIGHTDM_TYPE_LANGUAGE, "code", code, NULL);
@@ -92,12 +98,6 @@ update_languages (void)
have_languages = TRUE;
}
-static gboolean
-is_utf8 (const gchar *code)
-{
- return g_strrstr (code, ".utf8") || g_strrstr (code, ".UTF-8");
-}
-
/* Get a valid locale name that can be passed to setlocale(), so we always can use nl_langinfo() to get language and country names. */
static gchar *
get_locale_name (const gchar *code)
@@ -129,7 +129,7 @@ get_locale_name (const gchar *code)
for (gint i = 0; avail_locales[i]; i++)
{
const gchar *loc = avail_locales[i];
- if (!g_strrstr (loc, ".utf8"))
+ if (!is_utf8 (loc))
continue;
if (g_str_has_prefix (loc, language))
return g_strdup (loc);
@@ -214,10 +214,16 @@ lightdm_language_get_name (LightDMLanguage *language)
if (locale)
{
const gchar *current = setlocale (LC_ALL, NULL);
+#ifdef LC_IDENTIFICATION
setlocale (LC_IDENTIFICATION, locale);
+#endif
setlocale (LC_MESSAGES, "");
+#ifdef _NL_IDENTIFICATION_LANGUAGE
const gchar *language_en = nl_langinfo (_NL_IDENTIFICATION_LANGUAGE);
+#else
+ const gchar *language_en = "Unknown";
+#endif
if (language_en && strlen (language_en) > 0)
priv->name = g_strdup (dgettext ("iso_639_3", language_en));
@@ -254,10 +260,16 @@ lightdm_language_get_territory (LightDMLanguage *langu
if (locale)
{
gchar *current = setlocale (LC_ALL, NULL);
+#ifdef LC_IDENTIFICATION
setlocale (LC_IDENTIFICATION, locale);
+#endif
setlocale (LC_MESSAGES, "");
+#ifdef _NL_IDENTIFICATION_TERRITORY
gchar *country_en = nl_langinfo (_NL_IDENTIFICATION_TERRITORY);
+#else
+ gchar *country_en = "Unknown";
+#endif
if (country_en && strlen (country_en) > 0 && g_strcmp0 (country_en, "ISO") != 0)
priv->territory = g_strdup (dgettext ("iso_3166", country_en));