diff options
author | William Hua <william.hua@canonical.com> | 2015-02-17 16:29:37 -0500 |
---|---|---|
committer | William Hua <william.hua@canonical.com> | 2015-02-17 16:29:37 -0500 |
commit | 603fdf817fbecbc184853ca4a4a078a2e7072fde (patch) | |
tree | 6b81984dbb07b5c9c907f249a7343e716cf86fa4 | |
parent | c38ced78666aad06e32d5c5937b99c91b36e8729 (diff) | |
download | ayatana-indicator-keyboard-603fdf817fbecbc184853ca4a4a078a2e7072fde.tar.gz ayatana-indicator-keyboard-603fdf817fbecbc184853ca4a4a078a2e7072fde.tar.bz2 ayatana-indicator-keyboard-603fdf817fbecbc184853ca4a4a078a2e7072fde.zip |
Only try initializing Fcitx once.
-rw-r--r-- | lib/main.vala | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/main.vala b/lib/main.vala index 41ff5ff7..ab33a84a 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -42,6 +42,7 @@ public class Indicator.Keyboard.Service : Object { private uint panel_timeout; private Fcitx.InputMethod? fcitx; + private bool fcitx_initialized; private Source[]? sources; @@ -235,12 +236,16 @@ public class Indicator.Keyboard.Service : Object { [DBus (visible = false)] private Fcitx.InputMethod? get_fcitx () { - if (is_fcitx_active () && fcitx == null) { - try { - fcitx = new Fcitx.InputMethod (BusType.SESSION, DBusProxyFlags.NONE, 0); - ((!) fcitx).notify["current-im"].connect ((pspec) => { handle_changed_current ("current"); }); - } catch (Error error) { - warning ("error: %s", error.message); + if (!fcitx_initialized) { + fcitx_initialized = true; + + if (is_fcitx_active ()) { + try { + fcitx = new Fcitx.InputMethod (BusType.SESSION, DBusProxyFlags.NONE, 0); + ((!) fcitx).notify["current-im"].connect ((pspec) => { handle_changed_current ("current"); }); + } catch (Error error) { + warning ("error: %s", error.message); + } } } |