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:
Florian Müllner
2022-06-23 15:45:44 +02:00
committed by Marge Bot
parent db3916434e
commit a3db909383
5 changed files with 127 additions and 126 deletions

View File

@ -529,7 +529,7 @@ var LoginDialog = GObject.registerClass({
this._realmManager.connectObject('login-format-changed',
this._showRealmLoginHint.bind(this), this);
LoginManager.getLoginManager().getCurrentSessionProxy(this._gotGreeterSessionProxy.bind(this));
this._getGreeterSessionProxy();
// If the user list is enabled, it should take key focus; make sure the
// screen shield is initialized first to prevent it from stealing the
@ -982,10 +982,11 @@ var LoginDialog = GObject.registerClass({
});
}
_gotGreeterSessionProxy(proxy) {
this._greeterSessionProxy = proxy;
proxy.connectObject('g-properties-changed', () => {
if (proxy.Active)
async _getGreeterSessionProxy() {
const loginManager = LoginManager.getLoginManager();
this._greeterSessionProxy = await loginManager.getCurrentSessionProxy();
this._greeterSessionProxy?.connectObject('g-properties-changed', () => {
if (this._greeterSessionProxy.Active)
this._loginScreenSessionActivated();
}, this);
}