aboutsummaryrefslogtreecommitdiff
path: root/lib/main.vala
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-09-20 21:06:51 -0400
committerWilliam Hua <william.hua@canonical.com>2013-09-20 21:06:51 -0400
commit474217efa011b2f360edad72c1a8872dbe7d257e (patch)
tree78c889de4ae3c65f3c347458d457bfd10083ed0d /lib/main.vala
parent8031d6831d622d6420fb2e1c4e65926f7ba46231 (diff)
downloadayatana-indicator-keyboard-474217efa011b2f360edad72c1a8872dbe7d257e.tar.gz
ayatana-indicator-keyboard-474217efa011b2f360edad72c1a8872dbe7d257e.tar.bz2
ayatana-indicator-keyboard-474217efa011b2f360edad72c1a8872dbe7d257e.zip
Only use XKeyboardLayouts if InputSources is empty.
Diffstat (limited to 'lib/main.vala')
-rw-r--r--lib/main.vala25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/main.vala b/lib/main.vala
index e0557e34..485f37a4 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -209,12 +209,12 @@ public class Indicator.Keyboard.Service : Object {
foreach (var user in users) {
if (user.is_loaded) {
- var sources = user.input_sources;
- var layouts = user.xkeyboard_layouts;
+ var done = false;
VariantIter outer;
VariantIter inner;
+ var sources = user.input_sources;
sources.get ("aa{ss}", out outer);
while (outer.next ("a{ss}", out inner)) {
@@ -223,6 +223,8 @@ public class Indicator.Keyboard.Service : Object {
while (inner.next ("{&s&s}", out key, out source)) {
if (key == "xkb") {
+ done = true;
+
if (!added.contains (source)) {
list.add (source);
added.add (source);
@@ -231,14 +233,19 @@ public class Indicator.Keyboard.Service : Object {
}
}
- foreach (var layout in layouts) {
- var source = layout;
- source = source.replace (" ", "+");
- source = source.replace ("\t", "+");
+ if (!done) {
+ var layouts = user.xkeyboard_layouts;
+ foreach (var layout in layouts) {
+ done = true;
- if (!added.contains (source)) {
- list.add (source);
- added.add (source);
+ var source = layout;
+ source = source.replace (" ", "+");
+ source = source.replace ("\t", "+");
+
+ if (!added.contains (source)) {
+ list.add (source);
+ added.add (source);
+ }
}
}
}