From 083d11a0327d2f0d5ae254cd68968c71deadb03f Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 17 Jan 2018 17:01:24 +0100 Subject: [PATCH] misc: Make IBus a mandatory dependency IBus was initially made optional as gnome-shell depended on too recent API. This API is now old enough and gnome-shell is committing further to IBus by implementing a ClutterInputMethod through it. Let's just make IBus a mandatory dependency, instead of making code paths trickier to cater for situations where it's missing. --- js/misc/ibusManager.js | 23 ++++++++--------------- meson.build | 2 ++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index bbe2c7e1d..d2f171037 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -6,15 +6,11 @@ const Lang = imports.lang; const Mainloop = imports.mainloop; const Signals = imports.signals; -let IBusCandidatePopup; -try { - var IBus = imports.gi.IBus; - _checkIBusVersion(1, 5, 2); - IBusCandidatePopup = imports.ui.ibusCandidatePopup; -} catch (e) { - var IBus = null; - log(e); -} +const IBus = imports.gi.IBus; +const IBusCandidatePopup = imports.ui.ibusCandidatePopup; + +// Ensure runtime version matches +_checkIBusVersion(1, 5, 2); let _ibusManager = null; @@ -45,9 +41,6 @@ var IBusManager = new Lang.Class({ _PRELOAD_ENGINES_DELAY_TIME: 30, // sec _init: function() { - if (!IBus) - return; - IBus.init(); this._candidatePopup = new IBusCandidatePopup.CandidatePopup(); @@ -190,7 +183,7 @@ var IBusManager = new Lang.Class({ }, getEngineDesc: function(id) { - if (!IBus || !this._ready || !this._engines.hasOwnProperty(id)) + if (!this._ready || !this._engines.hasOwnProperty(id)) return null; return this._engines[id]; @@ -200,7 +193,7 @@ var IBusManager = new Lang.Class({ // Send id even if id == this._currentEngineName // because 'properties-registered' signal can be emitted // while this._ibusSources == null on a lock screen. - if (!IBus || !this._ready) { + if (!this._ready) { if (callback) callback(); return; @@ -211,7 +204,7 @@ var IBusManager = new Lang.Class({ }, preloadEngines: function(ids) { - if (!IBus || !this._ibus || ids.length == 0) + if (!this._ibus || ids.length == 0) return; if (this._preloadEnginesId != 0) { diff --git a/meson.build b/meson.build index 1eec6aa27..9822de892 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,7 @@ mutter_req = '>= 3.26.0' polkit_req = '>= 0.100' schemas_req = '>= 3.21.3' startup_req = '>= 0.11' +ibus_req = '>= 1.5.2' bt_req = '>= 3.9.0' gst_req = '>= 0.11.92' @@ -87,6 +88,7 @@ mutter_dep = dependency(libmutter_pc, version: mutter_req) polkit_dep = dependency('polkit-agent-1', version: polkit_req) soup_dep = dependency('libsoup-2.4') startup_dep = dependency('libstartup-notification-1.0', version: startup_req) +ibus_dep = dependency('ibus-1.0', version: ibus_req) x11_dep = dependency('x11') schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)