[gnome-shell] ScreenShield: properly handle ensureUnlockDialog() failure



commit 99af697cd79ef4e1713948f58b1bdfe40930bbb3
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jun 8 16:03:14 2013 +0200

    ScreenShield: properly handle ensureUnlockDialog() failure
    
    If that fails (which only ever happens in initial-setup mode, which
    has no unlock or login dialog), we don't want to go ahead with
    whatever we were doing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701848

 js/ui/screenShield.js |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 4e61c11..89601c0 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -583,8 +583,8 @@ const ScreenShield = new Lang.Class({
 
     _liftShield: function(onPrimary, velocity) {
         if (this._isLocked) {
-            this._ensureUnlockDialog(onPrimary, true /* allowCancel */);
-            this._hideLockScreen(true /* animate */, velocity);
+            if (this._ensureUnlockDialog(onPrimary, true /* allowCancel */))
+                this._hideLockScreen(true /* animate */, velocity);
         } else {
             this.deactivate(true /* animate */);
         }
@@ -621,9 +621,8 @@ const ScreenShield = new Lang.Class({
         if (!isEnter && !(GLib.unichar_isprint(unichar) || symbol == Clutter.KEY_Escape))
             return false;
 
-        this._ensureUnlockDialog(true, true);
-
-        if (GLib.unichar_isgraph(unichar))
+        if (this._ensureUnlockDialog(true, true) &&
+            GLib.unichar_isgraph(unichar))
             this._dialog.addCharacter(unichar);
 
         this._liftShield(true, 0);
@@ -864,8 +863,8 @@ const ScreenShield = new Lang.Class({
         this.actor.show();
         this._isGreeter = Main.sessionMode.isGreeter;
         this._isLocked = true;
-        this._ensureUnlockDialog(true, true);
-        this._hideLockScreen(false, 0);
+        if (this._ensureUnlockDialog(true, true))
+            this._hideLockScreen(false, 0);
     },
 
     _hideLockScreenComplete: function() {
@@ -915,7 +914,7 @@ const ScreenShield = new Lang.Class({
             if (!constructor) {
                 // This session mode has no locking capabilities
                 this.deactivate(true);
-                return;
+                return false;
             }
 
             this._dialog = new constructor(this._lockDialogGroup);
@@ -927,12 +926,14 @@ const ScreenShield = new Lang.Class({
                 // by the time we reach this...
                 log('Could not open login dialog: failed to acquire grab');
                 this.deactivate(true);
+                return false;
             }
 
             this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
         }
 
         this._dialog.allowCancel = allowCancel;
+        return true;
     },
 
     _onUnlockFailed: function() {


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