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>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3397>
This commit is contained in:
Philip Withnall 2024-04-23 17:26:45 +01:00 committed by Marge Bot
parent 67c5be9c53
commit a37d6d480b

View File

@ -104,6 +104,10 @@ class LoginManagerSystemd extends Signals.EventEmitter {
this._sessionRemoved.bind(this));
}
getCurrentUserProxy() {
return this._userProxy;
}
async getCurrentSessionProxy() {
if (this._currentSession)
return this._currentSession;
@ -218,6 +222,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()