[gnome-shell] loginManager: Extend canSuspend() callback



commit 1cb644529f49db0ff378dcd39ad555a35b763294
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu May 26 22:20:50 2016 +0200

    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

 js/misc/loginManager.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index 7db94d4..3e3df37 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -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) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]