Index: accountsservice-0.6.35/data/org.freedesktop.Accounts.User.xml
===================================================================
--- accountsservice-0.6.35.orig/data/org.freedesktop.Accounts.User.xml	2013-11-13 15:16:58.756125511 +0100
+++ accountsservice-0.6.35/data/org.freedesktop.Accounts.User.xml	2013-11-13 15:16:58.744125511 +0100
@@ -331,6 +331,41 @@
     </doc:doc>
   </method>
 
+  <method name="SetXKeyboardLayouts">
+    <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+    <arg name="layouts" direction="in" type="as">
+      <doc:doc>
+        <doc:summary>
+          The name of the keyboard layouts to use as the user's keyboard layout.  The first is the default.
+        </doc:summary>
+      </doc:doc>
+    </arg>
+    <doc:doc>
+      <doc:description>
+        <doc:para>
+          Sets the user's keyboard layouts.
+        </doc:para>
+      </doc:description>
+      <doc:permission>
+        The caller needs one of the following PolicyKit authorizations:
+        <doc:list>
+          <doc:item>
+            <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+            <doc:definition>To change his or her own keyboard layouts</doc:definition>
+          </doc:item>
+          <doc:item>
+            <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+            <doc:definition>To change the keyboard layouts of another user</doc:definition>
+          </doc:item>
+        </doc:list>
+      </doc:permission>
+      <doc:errors>
+        <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+        <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+      </doc:errors>
+    </doc:doc>
+  </method>
+
   <method name="SetBackgroundFile">
     <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
     <arg name="filename" direction="in" type="s">
@@ -758,6 +793,16 @@
         </doc:para>
       </doc:description>
     </doc:doc>
+  </property>
+
+  <property name="XKeyboardLayouts" type="as" access="read">
+    <doc:doc>
+      <doc:description>
+        <doc:para>
+           The names of the user's keyboard layouts.
+        </doc:para>
+      </doc:description>
+    </doc:doc>
   </property>
 
   <property name="BackgroundFile" type="s" access="read">
Index: accountsservice-0.6.35/src/user.c
===================================================================
--- accountsservice-0.6.35.orig/src/user.c	2013-11-13 15:16:58.756125511 +0100
+++ accountsservice-0.6.35/src/user.c	2013-11-13 15:16:58.748125511 +0100
@@ -64,6 +64,7 @@
         PROP_LOGIN_FREQUENCY,
         PROP_LOGIN_TIME,
         PROP_LOGIN_HISTORY,
+        PROP_X_KEYBOARD_LAYOUTS,
         PROP_BACKGROUND_FILE,
         PROP_ICON_FILE,
         PROP_LOCKED,
@@ -99,6 +100,7 @@
         gchar        *x_session;
         gchar        *location;
         guint64       login_frequency;
+        gchar       **x_keyboard_layouts;
         gchar        *background_file;
         gint64        login_time;
         GVariant     *login_history;
@@ -371,6 +373,13 @@
                 g_object_notify (G_OBJECT (user), "password-hint");
         }
 
+        s = g_key_file_get_string_list (keyfile, "User", "XKeyboardLayouts", NULL, NULL);
+        if (s != NULL) {
+                g_strfreev (user->x_keyboard_layouts);
+                user->x_keyboard_layouts = s;
+                g_object_notify (G_OBJECT (user), "xkeyboard-layouts");
+        }
+
         s = g_key_file_get_string (keyfile, "User", "Background", NULL);
         if (s != NULL) {
                 g_free (user->background_file);
@@ -445,6 +454,9 @@
         if (user->password_hint)
                 g_key_file_set_string (keyfile, "User", "PasswordHint", user->password_hint);
 
+        if (user->x_keyboard_layouts)
+                g_key_file_set_string_list (keyfile, "User", "XKeyboardLayouts", (const gchar * const *) user->x_keyboard_layouts, g_strv_length (user->x_keyboard_layouts));
+
         if (user->background_file)
                 g_key_file_set_string (keyfile, "User", "Background", user->background_file);
 
@@ -1800,6 +1812,55 @@
 }
 
 static void
+user_change_x_keyboard_layouts_authorized_cb (Daemon                *daemon,
+                                              User                  *user,
+                                              GDBusMethodInvocation *context,
+                                              gpointer               data)
+{
+        g_strfreev (user->x_keyboard_layouts);
+        user->x_keyboard_layouts = g_strdupv (data);
+
+        save_extra_data (user);
+
+        accounts_user_emit_changed (ACCOUNTS_USER (user));
+
+        g_object_notify (G_OBJECT (user), "xkeyboard-layouts");
+
+        accounts_user_complete_set_xkeyboard_layouts (ACCOUNTS_USER (user), context);
+}
+
+gboolean
+user_set_xkeyboard_layouts (AccountsUser          *auser,
+                            GDBusMethodInvocation *context,
+                            const gchar * const   *layouts)
+{
+        User *user = (User*)auser;
+        int uid;
+        const gchar *action_id;
+
+        if (!get_caller_uid (context, &uid)) {
+                throw_error (context, ERROR_FAILED, "identifying caller failed");
+                return FALSE;
+        }
+
+        if (user->uid == (uid_t) uid)
+                action_id = "org.freedesktop.accounts.change-own-user-data";
+        else
+                action_id = "org.freedesktop.accounts.user-administration";
+
+        daemon_local_check_auth (user->daemon,
+                                 user,
+                                 action_id,
+                                 TRUE,
+                                 user_change_x_keyboard_layouts_authorized_cb,
+                                 context,
+                                 g_strdupv (layouts),
+                                 (GDestroyNotify)g_strfreev);
+
+        return TRUE;
+}
+
+static void
 user_change_background_file_authorized_cb (Daemon                *daemon,
                                            User                  *user,
                                            GDBusMethodInvocation *context,
@@ -2680,6 +2741,7 @@
         g_free (user->real_name);
         g_free (user->home_dir);
         g_free (user->shell);
+        g_strfreev (user->x_keyboard_layouts);
         g_free (user->icon_file);
         g_free (user->default_icon_file);
         g_free (user->background_file);
@@ -2798,6 +2860,9 @@
         case PROP_LOCATION:
                 g_value_set_string (value, user->location);
                 break;
+        case PROP_X_KEYBOARD_LAYOUTS:
+                g_value_set_boxed (value, g_strdupv (user->x_keyboard_layouts));
+                break;
         case PROP_BACKGROUND_FILE:
                 g_value_set_string (value, user->background_file);
                 break;
@@ -2870,6 +2935,7 @@
         iface->handle_set_real_name = user_set_real_name;
         iface->handle_set_shell = user_set_shell;
         iface->handle_set_user_name = user_set_user_name;
+        iface->handle_set_xkeyboard_layouts = user_set_xkeyboard_layouts;
         iface->handle_set_xsession = user_set_x_session;
         iface->get_uid = user_real_get_uid;
         iface->get_user_name = user_real_get_user_name;
@@ -2902,6 +2968,7 @@
         user->account_type = ACCOUNT_TYPE_STANDARD;
         user->home_dir = NULL;
         user->shell = NULL;
+        user->x_keyboard_layouts = NULL;
         user->background_file = NULL;
         user->icon_file = NULL;
         user->default_icon_file = NULL;
Index: accountsservice-0.6.35/src/libaccountsservice/act-user.c
===================================================================
--- accountsservice-0.6.35.orig/src/libaccountsservice/act-user.c	2013-11-13 15:16:58.756125511 +0100
+++ accountsservice-0.6.35/src/libaccountsservice/act-user.c	2013-11-13 15:16:58.752125511 +0100
@@ -91,6 +91,7 @@
         PROP_LOGIN_FREQUENCY,
         PROP_LOGIN_TIME,
         PROP_LOGIN_HISTORY,
+        PROP_X_KEYBOARD_LAYOUTS,
         PROP_BACKGROUND_FILE,
         PROP_ICON_FILE,
         PROP_LANGUAGE,
@@ -122,6 +123,7 @@
         char           *shell;
         char           *email;
         char           *location;
+        char          **x_keyboard_layouts;
         char           *background_file;
         char           *icon_file;
         char           *language;
@@ -306,6 +308,9 @@
         case PROP_LOCATION:
                 g_value_set_string (value, user->location);
                 break;
+        case PROP_X_KEYBOARD_LAYOUTS:
+                g_value_set_boxed (value, g_strdupv (user->x_keyboard_layouts));
+                break;
         case PROP_BACKGROUND_FILE:
                 g_value_set_string (value, user->background_file);
                 break;
@@ -460,6 +465,13 @@
                                                                NULL,
                                                                G_PARAM_READABLE));
         g_object_class_install_property (gobject_class,
+                                         PROP_X_KEYBOARD_LAYOUTS,
+                                         g_param_spec_boxed ("xkeyboard-layouts",
+                                                             "Keyboard layouts",
+                                                             "The name of keyboard layouts for this user.",
+                                                             G_TYPE_STRV,
+                                                             G_PARAM_READABLE));
+        g_object_class_install_property (gobject_class,
                                          PROP_BACKGROUND_FILE,
                                          g_param_spec_string ("background-file",
                                                               "Background File",
@@ -597,6 +609,7 @@
 
         g_free (user->user_name);
         g_free (user->real_name);
+        g_strfreev (user->x_keyboard_layouts);
         g_free (user->background_file);
         g_free (user->icon_file);
         g_free (user->language);
@@ -1046,6 +1059,22 @@
 }
 
 /**
+ * act_user_get_x_keyboard_layouts:
+ * @user: a #ActUser
+ *
+ * Returns the name of the account keyboard layouts belonging to @user.
+ *
+ * Returns: (transfer none): names of keyboard layouts
+ */
+const char * const *
+act_user_get_x_keyboard_layouts (ActUser *user)
+{
+        g_return_val_if_fail (ACT_IS_USER (user), NULL);
+
+        return (const char * const *) user->x_keyboard_layouts;
+}
+
+/**
  * act_user_get_background_file:
  * @user: a #ActUser
  *
@@ -1167,6 +1196,28 @@
         return user->our_sessions->data;
 }
 
+static gboolean
+strv_equal (const char **a, const char **b)
+{
+        gint i;
+        gboolean same = TRUE;
+
+        if (a == b)
+                return TRUE;
+        else if (a == NULL || b == NULL)
+                return FALSE;
+
+        for (i = 0; a[i]; i++) {
+                if (g_strcmp0 (a[i], b[i]) != 0)
+                        return FALSE;
+        }
+
+        if (g_strcmp0 (a[i], b[i]) != 0)
+                return FALSE;
+
+        return TRUE;
+}
+
 static void
 collect_props (const gchar *key,
                GVariant    *value,
@@ -1319,6 +1370,15 @@
                         user->login_history = g_variant_ref (new_login_history);
                         g_object_notify (G_OBJECT (user), "login-history");
                 }
+        } else if (strcmp (key, "XKeyboardLayouts") == 0) {
+                const char **new_x_keyboard_layouts;
+
+                new_x_keyboard_layouts = g_variant_get_strv (value, NULL);
+                if (!strv_equal (user->x_keyboard_layouts, new_x_keyboard_layouts)) {
+                        g_strfreev (user->x_keyboard_layouts);
+                        user->x_keyboard_layouts = g_strdupv (new_x_keyboard_layouts);
+                        g_object_notify (G_OBJECT (user), "xkeyboard-layouts");
+                }
         } else if (strcmp (key, "BackgroundFile") == 0) {
                 const char *new_background_file;
 
@@ -1681,6 +1741,35 @@
                 g_error_free (error);
                 return;
         }
+}
+
+/**
+ * act_user_set_x_keyboard_layouts:
+ * @user: the user object to alter.
+ * @keyboard_layouts: names of keyboard layouts
+ *
+ * Assigns a new set of keyboard layouts for @user.
+ *
+ * Note this function is synchronous and ignores errors.
+ **/
+void
+act_user_set_x_keyboard_layouts (ActUser    *user,
+                                 const char * const *keyboard_layouts)
+{
+        GError *error = NULL;
+
+        g_return_if_fail (ACT_IS_USER (user));
+        g_return_if_fail (keyboard_layouts != NULL);
+        g_return_if_fail (ACCOUNTS_IS_USER (user->accounts_proxy));
+
+        if (!accounts_user_call_set_xkeyboard_layouts_sync (user->accounts_proxy,
+                                                            keyboard_layouts,
+                                                            NULL,
+                                                            &error)) {
+                g_warning ("SetXKeyboardLayouts call failed: %s", error->message);
+                g_error_free (error);
+                return;
+        }
 }
 
 /**
