[gnome-shell] loginDialog: Disable user list when no user



commit fbc5e3709e4a1988aba1acd5c6d9f1f2d126022a
Author: Xiaoguang Wang <xwang suse com>
Date:   Fri Jul 7 14:47:23 2017 +0800

    loginDialog: Disable user list when no user
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731320

 js/gdm/loginDialog.js |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 094a1f9..5055a0a 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -269,6 +269,10 @@ const UserList = new Lang.Class({
 
         item.actor.destroy();
         delete this._items[userName];
+    },
+
+    numItems: function() {
+        return Object.keys(this._items).length;
     }
 });
 Signals.addSignalMethods(UserList.prototype);
@@ -707,6 +711,10 @@ const LoginDialog = new Lang.Class({
     _updateDisableUserList: function() {
         let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
 
+        // Disable user list when there are no users.
+        if (this._userListLoaded && this._userList.numItems() == 0)
+            disableUserList = true;
+
         if (disableUserList != this._disableUserList) {
             this._disableUserList = disableUserList;
 
@@ -1178,14 +1186,18 @@ const LoginDialog = new Lang.Class({
             this._userList.addUser(users[i]);
         }
 
+        this._updateDisableUserList();
+
         this._userAddedId = this._userManager.connect('user-added',
                                                       Lang.bind(this, function(userManager, user) {
                                                           this._userList.addUser(user);
+                                                          this._updateDisableUserList();
                                                       }));
 
         this._userRemovedId = this._userManager.connect('user-removed',
                                                         Lang.bind(this, function(userManager, user) {
                                                             this._userList.removeUser(user);
+                                                            this._updateDisableUserList();
                                                         }));
 
         this._userChangedId = this._userManager.connect('user-changed',
@@ -1194,6 +1206,7 @@ const LoginDialog = new Lang.Class({
                                                                 this._userList.removeUser(user);
                                                             else if (!this._userList.containsUser(user) && 
!user.locked)
                                                                 this._userList.addUser(user);
+                                                            this._updateDisableUserList();
                                                         }));
 
         return GLib.SOURCE_REMOVE;


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