aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2014-04-05 00:01:23 +1300
committerWilliam Hua <william.hua@canonical.com>2014-04-05 00:01:23 +1300
commitef122381c53550ba4e0512e28f6b12386772f34b (patch)
treec623845a4d413641ea0b2206edf56671dbba8a49
parent3b4b8a3415c837dc2ad26385df5716b63350d104 (diff)
downloadayatana-indicator-keyboard-ef122381c53550ba4e0512e28f6b12386772f34b.tar.gz
ayatana-indicator-keyboard-ef122381c53550ba4e0512e28f6b12386772f34b.tar.bz2
ayatana-indicator-keyboard-ef122381c53550ba4e0512e28f6b12386772f34b.zip
Remember to update indicator action with active input source.
-rw-r--r--lib/main.vala17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/main.vala b/lib/main.vala
index cabc8c2a..dde166f6 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -672,20 +672,19 @@ public class Indicator.Keyboard.Service : Object {
[DBus (visible = false)]
private void update_indicator_action () {
- var visible = indicator_settings.get_boolean ("visible");
- var current = source_settings.get_uint ("current");
- var sources = get_sources ();
-
Icon? icon = null;
string? name = null;
- if (current < sources.length) {
- icon = sources[current].icon;
- name = sources[current].name;
+ var sources = get_sources ();
+ var active = get_active_action ().get_state ().get_uint32 ();
+
+ if (active < sources.length) {
+ icon = sources[active].icon;
+ name = sources[active].name;
}
var builder = new VariantBuilder (new VariantType ("a{sv}"));
- builder.add ("{sv}", "visible", new Variant.boolean (visible));
+ builder.add ("{sv}", "visible", indicator_settings.get_value ("visible"));
if (name != null) {
var description = _ ("%s input source").printf ((!) name);
builder.add ("{sv}", "accessible-desc", new Variant.string (description));
@@ -712,6 +711,7 @@ public class Indicator.Keyboard.Service : Object {
private void handle_changed_active (Variant? value) {
if (value != null) {
((!) active_action).set_state ((!) value);
+ update_indicator_action ();
if (keyboard_plugin != null) {
try {
@@ -727,6 +727,7 @@ public class Indicator.Keyboard.Service : Object {
private void update_active_action () {
if (active_action != null) {
((!) active_action).set_state (source_settings.get_value ("current"));
+ update_indicator_action ();
}
}