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.
This commit is contained in:
Carlos Garnacho 2018-01-17 17:01:24 +01:00
parent e0852e5991
commit 083d11a032
2 changed files with 10 additions and 15 deletions

View File

@ -6,15 +6,11 @@ const Lang = imports.lang;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const Signals = imports.signals; const Signals = imports.signals;
let IBusCandidatePopup; const IBus = imports.gi.IBus;
try { const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
var IBus = imports.gi.IBus;
_checkIBusVersion(1, 5, 2); // Ensure runtime version matches
IBusCandidatePopup = imports.ui.ibusCandidatePopup; _checkIBusVersion(1, 5, 2);
} catch (e) {
var IBus = null;
log(e);
}
let _ibusManager = null; let _ibusManager = null;
@ -45,9 +41,6 @@ var IBusManager = new Lang.Class({
_PRELOAD_ENGINES_DELAY_TIME: 30, // sec _PRELOAD_ENGINES_DELAY_TIME: 30, // sec
_init: function() { _init: function() {
if (!IBus)
return;
IBus.init(); IBus.init();
this._candidatePopup = new IBusCandidatePopup.CandidatePopup(); this._candidatePopup = new IBusCandidatePopup.CandidatePopup();
@ -190,7 +183,7 @@ var IBusManager = new Lang.Class({
}, },
getEngineDesc: function(id) { getEngineDesc: function(id) {
if (!IBus || !this._ready || !this._engines.hasOwnProperty(id)) if (!this._ready || !this._engines.hasOwnProperty(id))
return null; return null;
return this._engines[id]; return this._engines[id];
@ -200,7 +193,7 @@ var IBusManager = new Lang.Class({
// Send id even if id == this._currentEngineName // Send id even if id == this._currentEngineName
// because 'properties-registered' signal can be emitted // because 'properties-registered' signal can be emitted
// while this._ibusSources == null on a lock screen. // while this._ibusSources == null on a lock screen.
if (!IBus || !this._ready) { if (!this._ready) {
if (callback) if (callback)
callback(); callback();
return; return;
@ -211,7 +204,7 @@ var IBusManager = new Lang.Class({
}, },
preloadEngines: function(ids) { preloadEngines: function(ids) {
if (!IBus || !this._ibus || ids.length == 0) if (!this._ibus || ids.length == 0)
return; return;
if (this._preloadEnginesId != 0) { if (this._preloadEnginesId != 0) {

View File

@ -27,6 +27,7 @@ mutter_req = '>= 3.26.0'
polkit_req = '>= 0.100' polkit_req = '>= 0.100'
schemas_req = '>= 3.21.3' schemas_req = '>= 3.21.3'
startup_req = '>= 0.11' startup_req = '>= 0.11'
ibus_req = '>= 1.5.2'
bt_req = '>= 3.9.0' bt_req = '>= 3.9.0'
gst_req = '>= 0.11.92' 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) polkit_dep = dependency('polkit-agent-1', version: polkit_req)
soup_dep = dependency('libsoup-2.4') soup_dep = dependency('libsoup-2.4')
startup_dep = dependency('libstartup-notification-1.0', version: startup_req) startup_dep = dependency('libstartup-notification-1.0', version: startup_req)
ibus_dep = dependency('ibus-1.0', version: ibus_req)
x11_dep = dependency('x11') x11_dep = dependency('x11')
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req) schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)