mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
loginManager: Add session-removed signal and getSession method
These changes will be used by the next commit when displaying a conflicting session dialog. session-removed signal will be used to close the conflicting session dialog if it's not needed anymore. getSession method will be used when a session is opened, to check if there's already a conflicting opened session. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3134>
This commit is contained in:
parent
7e4c7678f1
commit
3517749537
1 changed files with 14 additions and 0 deletions
|
|
@ -101,6 +101,8 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
|||
'/org/freedesktop/login1/user/self');
|
||||
this._proxy.connectSignal('PrepareForSleep',
|
||||
this._prepareForSleep.bind(this));
|
||||
this._proxy.connectSignal('SessionRemoved',
|
||||
this._sessionRemoved.bind(this));
|
||||
}
|
||||
|
||||
async getCurrentSessionProxy() {
|
||||
|
|
@ -189,6 +191,10 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
getSession(objectPath) {
|
||||
return new SystemdLoginSession(Gio.DBus.system, 'org.freedesktop.login1', objectPath);
|
||||
}
|
||||
|
||||
suspend() {
|
||||
this._proxy.SuspendAsync(true);
|
||||
}
|
||||
|
|
@ -206,6 +212,10 @@ class LoginManagerSystemd extends Signals.EventEmitter {
|
|||
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||
this.emit('prepare-for-sleep', aboutToSuspend);
|
||||
}
|
||||
|
||||
_sessionRemoved(proxy, sender, [sessionId]) {
|
||||
this.emit('session-removed', sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
class LoginManagerDummy extends Signals.EventEmitter {
|
||||
|
|
@ -237,6 +247,10 @@ class LoginManagerDummy extends Signals.EventEmitter {
|
|||
return new Promise(resolve => resolve([]));
|
||||
}
|
||||
|
||||
getSession(_objectPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
suspend() {
|
||||
this.emit('prepare-for-sleep', true);
|
||||
this.emit('prepare-for-sleep', false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue