aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--lib/main.vala25
-rw-r--r--po/indicator-keyboard.pot2
2 files changed, 17 insertions, 10 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);
+ }
}
}
}
diff --git a/po/indicator-keyboard.pot b/po/indicator-keyboard.pot
index df7dd668..bdfffeca 100644
--- a/po/indicator-keyboard.pot
+++ b/po/indicator-keyboard.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-08-29 10:20+0800\n"
+"POT-Creation-Date: 2013-09-20 20:56-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"