mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
loginManager: Extend canSuspend() callback
The underlying logind API does not only indicate whether suspend is available, but also whether the user is eligible for executing the operation without further authentication. This information can be relevant, so pass it to the callback. https://bugzilla.gnome.org/show_bug.cgi?id=725960
This commit is contained in:
parent
6cff0fd994
commit
1cb644529f
1 changed files with 8 additions and 5 deletions
|
|
@ -134,10 +134,13 @@ const LoginManagerSystemd = new Lang.Class({
|
|||
|
||||
canSuspend: function(asyncCallback) {
|
||||
this._proxy.CanSuspendRemote(function(result, error) {
|
||||
if (error)
|
||||
asyncCallback(false);
|
||||
else
|
||||
asyncCallback(result[0] != 'no' && result[0] != 'na');
|
||||
if (error) {
|
||||
asyncCallback(false, false);
|
||||
} else {
|
||||
let needsAuth = result[0] == 'challenge';
|
||||
let canSuspend = needsAuth || result[0] == 'yes';
|
||||
asyncCallback(canSuspend, needsAuth);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -190,7 +193,7 @@ const LoginManagerDummy = new Lang.Class({
|
|||
},
|
||||
|
||||
canSuspend: function(asyncCallback) {
|
||||
asyncCallback(false);
|
||||
asyncCallback(false, false);
|
||||
},
|
||||
|
||||
listSessions: function(asyncCallback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue