ibusManager: Allow passing callbacks after enabling/disabling completion

Since this is an async operation, we may want to let some things happen
after the engine is changed due to completion being enabled/disabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2512>
This commit is contained in:
Carlos Garnacho 2022-10-17 13:29:10 +02:00 committed by Marge Bot
parent ebc5319a08
commit 290dd38a3a

View File

@ -337,7 +337,7 @@ var IBusManager = class extends Signals.EventEmitter {
}); });
} }
setCompletionEnabled(enabled) { setCompletionEnabled(enabled, callback) {
/* Needs typing-booster available */ /* Needs typing-booster available */
if (!this._engines.has(TYPING_BOOSTER_ENGINE)) if (!this._engines.has(TYPING_BOOSTER_ENGINE))
return false; return false;
@ -373,12 +373,12 @@ var IBusManager = class extends Signals.EventEmitter {
settings.reset(KEY_INLINECOMPLETION); settings.reset(KEY_INLINECOMPLETION);
settings.set_string(KEY_INPUTMETHOD, 'NoIME'); settings.set_string(KEY_INPUTMETHOD, 'NoIME');
this.setEngine(TYPING_BOOSTER_ENGINE); this.setEngine(TYPING_BOOSTER_ENGINE, callback);
} else if (this._preOskState) { } else if (this._preOskState) {
const {engine, emoji, langs, completion, inputMethod} = const {engine, emoji, langs, completion, inputMethod} =
this._preOskState; this._preOskState;
this._preOskState = null; this._preOskState = null;
this.setEngine(engine); this.setEngine(engine, callback);
settings.set_value(KEY_EMOJIPREDICTIONS, emoji); settings.set_value(KEY_EMOJIPREDICTIONS, emoji);
settings.set_value(KEY_DICTIONARY, langs); settings.set_value(KEY_DICTIONARY, langs);
settings.set_value(KEY_INLINECOMPLETION, completion); settings.set_value(KEY_INLINECOMPLETION, completion);