aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-09-20 23:23:17 -0400
committerWilliam Hua <william.hua@canonical.com>2013-09-20 23:23:17 -0400
commitb4546f5c93ecfd844621942388f526c82a8c10bd (patch)
tree0f04b69269935255ed6b2fa8f1f6b73dd4c33faa /lib
parentf485f87438c2c80bf378b42d997e9adde4d99cae (diff)
downloadayatana-indicator-keyboard-b4546f5c93ecfd844621942388f526c82a8c10bd.tar.gz
ayatana-indicator-keyboard-b4546f5c93ecfd844621942388f526c82a8c10bd.tar.bz2
ayatana-indicator-keyboard-b4546f5c93ecfd844621942388f526c82a8c10bd.zip
Use old user layouts if they haven't migrated yet.
Diffstat (limited to 'lib')
-rw-r--r--lib/main.vala28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/main.vala b/lib/main.vala
index 7daba518..df962c98 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -147,6 +147,13 @@ public class Indicator.Keyboard.Service : Object {
}
});
}
+
+ var user_list = LightDM.UserList.get_instance ();
+
+ user_list.user_added.connect ((user) => { migrate_input_sources (); });
+ user_list.user_changed.connect ((user) => { migrate_input_sources (); });
+ user_list.user_removed.connect ((user) => { migrate_input_sources (); });
+ user_list.get_user_by_name ("this line force loads the users");
} else {
if (!indicator_settings.get_boolean ("migrated")) {
var builder = new VariantBuilder (new VariantType ("a(ss)"));
@@ -248,6 +255,27 @@ public class Indicator.Keyboard.Service : Object {
}
}
}
+
+ if (!done) {
+ var user_list = LightDM.UserList.get_instance ();
+ LightDM.User? light_user = user_list.get_user_by_name (user.user_name);
+
+ if (light_user != null) {
+ var layouts = ((!) light_user).get_layouts ();
+ foreach (var layout in layouts) {
+ done = true;
+
+ var source = layout;
+ source = source.replace (" ", "+");
+ source = source.replace ("\t", "+");
+
+ if (!added.contains (source)) {
+ list.add (source);
+ added.add (source);
+ }
+ }
+ }
+ }
}
}