diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2011-09-20 10:25:04 +1000 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2011-09-20 10:25:04 +1000 |
commit | b34ddd2b987636d41f6a6490f4d9bb66ee2f5a46 (patch) | |
tree | 054577ef473cc18b57ee97d2a433925d6d12d274 /src/greeter.c | |
parent | a6116ba970407377c3e25775da8dffe938c01367 (diff) | |
download | lightdm-b34ddd2b987636d41f6a6490f4d9bb66ee2f5a46.tar.gz |
Add ability to set the language of a user from the greeter
Diffstat (limited to 'src/greeter.c')
-rw-r--r-- | src/greeter.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/greeter.c b/src/greeter.c index 392555c1..a1e28712 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -68,7 +68,8 @@ typedef enum GREETER_MESSAGE_AUTHENTICATE_AS_GUEST, GREETER_MESSAGE_CONTINUE_AUTHENTICATION, GREETER_MESSAGE_START_SESSION, - GREETER_MESSAGE_CANCEL_AUTHENTICATION + GREETER_MESSAGE_CANCEL_AUTHENTICATION, + GREETER_MESSAGE_SET_LANGUAGE } GreeterMessage; /* Messages from the server to the greeter */ @@ -408,6 +409,28 @@ handle_start_session (Greeter *greeter, const gchar *session) } } +static void +handle_set_language (Greeter *greeter, const gchar *language) +{ + User *user; + + if (!greeter->priv->guest_account_authenticated && !pam_session_get_is_authenticated (greeter->priv->authentication)) + { + g_debug ("Ignoring set language request, user is not authorized"); + return; + } + + // FIXME: Could use this + if (greeter->priv->guest_account_authenticated) + { + g_debug ("Ignoring set language request for guest user"); + return; + } + + user = pam_session_get_user (greeter->priv->authentication); + user_set_language (user, language); +} + static guint32 read_int (Greeter *greeter, gsize *offset) { @@ -453,7 +476,7 @@ read_cb (GIOChannel *source, GIOCondition condition, gpointer data) GIOStatus status; int id, n_secrets, i; guint32 sequence_number; - gchar *version, *username, *session_name; + gchar *version, *username, *session_name, *language; gchar **secrets; GError *error = NULL; @@ -539,6 +562,11 @@ read_cb (GIOChannel *source, GIOCondition condition, gpointer data) handle_start_session (greeter, session_name); g_free (session_name); break; + case GREETER_MESSAGE_SET_LANGUAGE: + language = read_string (greeter, &offset); + handle_set_language (greeter, language); + g_free (language); + break; default: g_warning ("Unknown message from greeter: %d", id); break; |