ibusManager: Change return value of setCompletionEnabled()

The return value currently indicates whether the request was
successful, namely `setCompletionEnabled(false)` will return
`true` if completions were successfully disabled.

However the only caller that uses the value uses it to indicate
whether completions were enabled.

Given that nothing else uses the value, change the meaning to
match the caller, and indicate whether completions are enabled
after the call returns.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3439>
This commit is contained in:
Sundeep Mediratta 2024-08-04 13:33:47 -04:00 committed by Florian Müllner
parent ce89b15bb1
commit 2975afaf1d

View File

@ -333,6 +333,11 @@ class IBusManager extends Signals.EventEmitter {
});
}
/**
* @param {boolean} enabled - whether completion should be enabled
*
* @returns {boolean} - whether completion are enabled
*/
async setCompletionEnabled(enabled) {
/* Needs typing-booster available */
if (enabled && !this._engines.has(TYPING_BOOSTER_ENGINE))
@ -342,7 +347,7 @@ class IBusManager extends Signals.EventEmitter {
return false;
if (this._oskCompletion === enabled)
return true;
return enabled;
this._oskCompletion = enabled;
@ -353,6 +358,6 @@ class IBusManager extends Signals.EventEmitter {
await this._setEngine(this._preOskEngine);
delete this._preOskEngine;
}
return true;
return this._oskCompletion;
}
}