aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog6
-rw-r--r--lib/main.vala17
2 files changed, 20 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 12262835..52f92bd2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-keyboard (0.0.0-0ubuntu13) saucy; urgency=low
+
+ * Migrate old keyboard layouts.
+
+ -- William Hua <william.hua@canonical.com> Thu, 20 Jun 2013 13:50:00 -0400
+
indicator-keyboard (0.0.0-0ubuntu12) saucy; urgency=low
* Remove indicator-keyboard-schema.
diff --git a/lib/main.vala b/lib/main.vala
index e06c7794..b9560459 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -72,11 +72,19 @@ public class Indicator.Keyboard.Service : Object {
var engines = ibus.list_active_engines ();
foreach (var engine in engines) {
- if (length == 0) {
+ if (length == 0 || engine.name.has_prefix ("xkb")) {
var source = "us";
var layout = engine.get_layout ();
var variant = engine.get_layout_variant ();
+ if (layout != null && layout.length == 0) {
+ layout = null;
+ }
+
+ if (variant != null && variant.length == 0) {
+ variant = null;
+ }
+
if (layout != null && variant != null) {
source = @"$layout+$variant";
} else if (layout != null) {
@@ -84,10 +92,13 @@ public class Indicator.Keyboard.Service : Object {
}
builder.add ("(ss)", "xkb", source);
+ length++;
}
- builder.add ("(ss)", "ibus", engine.name);
- length++;
+ if (!engine.name.has_prefix ("xkb")) {
+ builder.add ("(ss)", "ibus", engine.name);
+ length++;
+ }
}
this.source_settings.set_value ("sources", builder.end ());