[gnome-shell/wip/disable-user-list: 3/3] wip: disable-user-list



commit 82a9ffebe965f884ad4ee155052165e6f90a0a8b
Author: Ray Strode <rstrode redhat com>
Date:   Tue Oct 30 13:26:30 2012 -0400

    wip: disable-user-list
    
    implement disable user list key.
    
    Based on a patch by Marius Rieder

 js/gdm/loginDialog.js |   93 ++++++++++++++++++++++++++++++++-----------------
 js/gdm/util.js        |    1 +
 2 files changed, 62 insertions(+), 32 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 664e98d..e861fd9 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -684,9 +684,10 @@ const LoginDialog = new Lang.Class({
         this._userVerifier = new GdmUtil.ShellUserVerifier(this._greeterClient);
         this._userVerifier.connect('ask-question', Lang.bind(this, this._askQuestion));
         this._userVerifier.connect('show-message', Lang.bind(this, this._showMessage));
-        this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
+        this._userVerifier.connect('reset', Lang.bind(this, this._reset));
         this._userVerifier.connect('show-login-hint', Lang.bind(this, this._showLoginHint));
         this._userVerifier.connect('hide-login-hint', Lang.bind(this, this._hideLoginHint));
+        this._verifyingUser = false;
 
         this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
 
@@ -694,6 +695,8 @@ const LoginDialog = new Lang.Class({
                                Lang.bind(this, this._updateBanner));
         this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_TEXT_KEY,
                                Lang.bind(this, this._updateBanner));
+        this._settings.connect('changed::' + GdmUtil.DISABLE_USER_LIST_KEY,
+                               Lang.bind(this, this._updateDisableUserList));
 
         this._bannerLabel = new St.Label({ style_class: 'login-dialog-banner',
                                            text: '' });
@@ -706,6 +709,7 @@ const LoginDialog = new Lang.Class({
         this.contentLayout.add(this._titleLabel,
                               { y_fill: false,
                                 y_align: St.Align.START });
+        this._titleLabel.hide();
 
         this._userList = new UserList();
         this.contentLayout.add(this._userList.actor,
@@ -769,7 +773,7 @@ const LoginDialog = new Lang.Class({
                                                 x_align: St.Align.START,
                                                 x_fill: true });
 
-        this._notListedButton.connect('clicked', Lang.bind(this, this._onNotListedClicked));
+        this._notListedButton.connect('clicked', Lang.bind(this, this._hideUserListAndLogIn));
 
         this.contentLayout.add(this._notListedButton,
                                { expand: false,
@@ -795,6 +799,16 @@ const LoginDialog = new Lang.Class({
 
    },
 
+    _updateDisableUserList: function() {
+        let disableUserList = true;//this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
+        if (disableUserList != this._disableUserList) {
+            this._disableUserList = disableUserList;
+
+            if (!this._verifyingUser)
+              this._reset();
+        }
+    },
+
     _updateBanner: function() {
         let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
         let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
@@ -807,31 +821,15 @@ const LoginDialog = new Lang.Class({
         }
     },
 
-    _onReset: function(client, serviceName) {
+    _reset: function() {
         this._promptMessage.hide();
-
-        let tasks = [this._hidePrompt,
-
-                     new Batch.ConcurrentBatch(this, [this._fadeInTitleLabel,
-                                                      this._fadeInNotListedButton]),
-
-                     function() {
-                         this._sessionList.close();
-                         this._promptLoginHint.hide();
-                         this._userList.actor.show();
-                         this._userList.actor.opacity = 255;
-                         return this._userList.showItems();
-                     },
-
-                     function() {
-                         this._userList.actor.reactive = true;
-                         this._userList.actor.grab_key_focus();
-                     }];
-
         this._user = null;
+        this._verifyingUser = false;
 
-        let batch = new Batch.ConsecutiveBatch(this, tasks);
-        batch.run();
+        if (this._disableUserList)
+            this._hideUserListAndLogIn();
+        else
+            this._showUserList();
     },
 
     _onDefaultSessionChanged: function(client, sessionId) {
@@ -886,6 +884,9 @@ const LoginDialog = new Lang.Class({
                          if (this._user && this._user.is_logged_in())
                              return null;
 
+                         if (!this._verifyingUser)
+                             return null;
+
                          return GdmUtil.fadeInActor(this._sessionList.actor);
                      },
 
@@ -901,14 +902,16 @@ const LoginDialog = new Lang.Class({
     _showPrompt: function() {
         let hold = new Batch.Hold();
 
-        let buttons = [{ action: Lang.bind(this, this.cancel),
-                         label: _("Cancel"),
-                         key: Clutter.Escape },
-                       { action: Lang.bind(this, function() {
+        let buttons = [];
+        if (!this._disableUserList || this._verifyingUser)
+            buttons.push({ action: Lang.bind(this, this.cancel),
+                          label: _("Cancel"),
+                          key: Clutter.Escape });
+        buttons.push({ action: Lang.bind(this, function() {
                                      hold.release();
-                                 }),
-                         label: C_("button", "Sign In"),
-                         default: true }];
+                               }),
+                       label: C_("button", "Sign In"),
+                       default: true });
 
         let tasks = [function() {
                          return this._fadeInPrompt();
@@ -1106,7 +1109,30 @@ const LoginDialog = new Lang.Class({
                              }));
     },
 
-    _onNotListedClicked: function() {
+    _showUserList: function() {
+        let tasks = [this._hidePrompt,
+
+                     new Batch.ConcurrentBatch(this, [this._fadeInTitleLabel,
+                                                      this._fadeInNotListedButton]),
+
+                     function() {
+                         this._sessionList.close();
+                         this._promptLoginHint.hide();
+                         this._userList.actor.show();
+                         this._userList.actor.opacity = 255;
+                         return this._userList.showItems();
+                     },
+
+                     function() {
+                         this._userList.actor.reactive = true;
+                         this._userList.actor.grab_key_focus();
+                     }];
+
+        let batch = new Batch.ConsecutiveBatch(this, tasks);
+        batch.run();
+    },
+
+    _hideUserListAndLogIn: function() {
         let tasks = [function() {
                          return this._userList.hideItems();
                      },
@@ -1158,6 +1184,7 @@ const LoginDialog = new Lang.Class({
         let hold = new Batch.Hold();
 
         this._userVerifier.begin(userName, hold);
+        this._verifyingUser = true;
         return hold;
     },
 
@@ -1210,6 +1237,8 @@ const LoginDialog = new Lang.Class({
             this._userList.addUser(users[i]);
         }
 
+        this._updateDisableUserList();
+
         this._userManager.connect('user-added',
                                   Lang.bind(this, function(userManager, user) {
                                       this._userList.addUser(user);
diff --git a/js/gdm/util.js b/js/gdm/util.js
index d71e55f..881d859 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -23,6 +23,7 @@ const BANNER_MESSAGE_TEXT_KEY = 'banner-message-text';
 const ALLOWED_FAILURES_KEY = 'allowed-failures';
 
 const LOGO_KEY = 'logo';
+const DISABLE_USER_LIST_KEY = 'disable-user-list';
 
 function fadeInActor(actor) {
     if (actor.opacity == 255 && actor.visible)



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