loginManager: Make API promise-based
The LoginManager abstraction is still mostly callback-based, not least because the methods are thin wrappers around logind D-Bus calls. However as gjs' dbus wrapper now generates promised-based wrappers as well, we can implement a proper async API just as naturally. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
This commit is contained in:

committed by
Marge Bot

parent
db3916434e
commit
a3db909383
@ -347,13 +347,11 @@ const SystemActions = GObject.registerClass({
|
||||
this.notify('can-restart');
|
||||
}
|
||||
|
||||
_updateHaveSuspend() {
|
||||
this._loginManager.canSuspend(
|
||||
(canSuspend, needsAuth) => {
|
||||
this._canHaveSuspend = canSuspend;
|
||||
this._suspendNeedsAuth = needsAuth;
|
||||
this._updateSuspend();
|
||||
});
|
||||
async _updateHaveSuspend() {
|
||||
const [canSuspend, needsAuth] = await this._loginManager.canSuspend();
|
||||
this._canHaveSuspend = canSuspend;
|
||||
this._suspendNeedsAuth = needsAuth;
|
||||
this._updateSuspend();
|
||||
}
|
||||
|
||||
_updateSuspend() {
|
||||
|
Reference in New Issue
Block a user