loginManager: Allow access to the D-Bus user proxy

It’s needed in an upcoming commit, to watch the user’s state
(active/online/offline/lingering/closing).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-04-23 17:26:45 +01:00
parent f9274bda97
commit 54b9972e53
No known key found for this signature in database
GPG key ID: DCDF5885B1F3ED73

View file

@ -106,6 +106,10 @@ class LoginManagerSystemd extends Signals.EventEmitter {
this._sessionRemoved.bind(this));
}
getCurrentUserProxy() {
return this._userProxy;
}
async getCurrentSessionProxy() {
if (this._currentSession)
return this._currentSession;
@ -220,6 +224,12 @@ class LoginManagerSystemd extends Signals.EventEmitter {
}
class LoginManagerDummy extends Signals.EventEmitter {
getCurrentUserProxy() {
// we could return a DummyUser object that fakes whatever callers
// expect, but just never settling the promise should be safer
return new Promise(() => {});
}
getCurrentSessionProxy() {
// we could return a DummySession object that fakes whatever callers
// expect (at the time of writing: connect() and connectSignal()