js: Use async D-Bus wrappers

After porting the more complex cases - in particular those that
affect a module's API - we are left with straight-forward D-Bus
method calls that can be moved to promise-based wrappers in one
go.

For consistency, this also switches from Remote to Async where
the call result is ignored.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
This commit is contained in:
Florian Müllner
2022-06-23 14:53:29 +02:00
committed by Marge Bot
parent a3db909383
commit 637ee7386e
23 changed files with 462 additions and 496 deletions

View File

@ -376,7 +376,7 @@ var ShellUserVerifier = class extends Signals.EventEmitter {
this.emit('show-message', null, null, MessageType.NONE);
}
_checkForFingerprintReader() {
async _checkForFingerprintReader() {
this._fingerprintReaderType = FingerprintReaderType.NONE;
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
@ -385,21 +385,19 @@ var ShellUserVerifier = class extends Signals.EventEmitter {
return;
}
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
(params, error) => {
if (!error && params) {
const [device] = params;
const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system,
'net.reactivated.Fprint',
device);
const fprintDeviceType = fprintDeviceProxy['scan-type'];
try {
const [device] = await this._fprintManager.GetDefaultDeviceAsync(
Gio.DBusCallFlags.NONE, this._cancellable);
const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system,
'net.reactivated.Fprint',
device);
const fprintDeviceType = fprintDeviceProxy['scan-type'];
this._fingerprintReaderType = fprintDeviceType === 'swipe'
? FingerprintReaderType.SWIPE
: FingerprintReaderType.PRESS;
this._updateDefaultService();
}
});
this._fingerprintReaderType = fprintDeviceType === 'swipe'
? FingerprintReaderType.SWIPE
: FingerprintReaderType.PRESS;
this._updateDefaultService();
} catch (e) {}
}
_onCredentialManagerAuthenticated(credentialManager, _token) {