loginManager: Return objects instead of multiple booleans

Multiple booleans - both in arguments and return values - are almost
always problematic API, because people have to memorize (or more likely
look up) the meaning of each position.

Instead, return a JS object so each value has a name attached to it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2370>
This commit is contained in:
Florian Müllner
2022-07-08 16:23:39 +02:00
parent 637ee7386e
commit 0c68c33826
3 changed files with 24 additions and 12 deletions

View File

@ -351,7 +351,7 @@ const SystemActions = GObject.registerClass({
}
async _updateHaveSuspend() {
const [canSuspend, needsAuth] = await this._loginManager.canSuspend();
const {canSuspend, needsAuth} = await this._loginManager.canSuspend();
this._canHaveSuspend = canSuspend;
this._suspendNeedsAuth = needsAuth;
this._updateSuspend();