From 603fdf817fbecbc184853ca4a4a078a2e7072fde Mon Sep 17 00:00:00 2001 From: William Hua Date: Tue, 17 Feb 2015 16:29:37 -0500 Subject: Only try initializing Fcitx once. --- lib/main.vala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib') 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); + } } } -- cgit v1.2.3