File gnome-shell-defer-loading-userlist.patch of Package gnome-shell.1083

diff -Npur gnome-shell-3.10.3/js/gdm/loginDialog.js gnome-shell-3.10.3.new/js/gdm/loginDialog.js
--- gnome-shell-3.10.3/js/gdm/loginDialog.js	2014-03-26 14:03:23.919803419 +0800
+++ gnome-shell-3.10.3.new/js/gdm/loginDialog.js	2014-03-26 14:55:14.943390531 +0800
@@ -501,18 +501,6 @@ const LoginDialog = new Lang.Class({
         this.actor.add_child(this._logoBin);
         this._updateLogo();
 
-        if (!this._userManager.is_loaded)
-            this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
-                                                                  Lang.bind(this, function() {
-                                                                      if (this._userManager.is_loaded) {
-                                                                          this._loadUserList();
-                                                                          this._userManager.disconnect(this._userManagerLoadedId);
-                                                                          this._userManagerLoadedId = 0;
-                                                                      }
-                                                                  }));
-        else
-            this._loadUserList();
-
         this._userList.connect('activate',
                                Lang.bind(this, function(userList, item) {
                                    this._onUserListActivated(item);
@@ -528,8 +516,31 @@ const LoginDialog = new Lang.Class({
         this._sessionMenuButton.actor.show();
         this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor);
 
+        this._disableUserList = undefined;
+        this._userListLoaded = false;
+
+        // If the user list is enabled, it should take key focus; make sure the
+        // screen shield is initialized first to prevent it from stealing the
+        // focus later
+        Main.layoutManager.connect('startup-complete',
+                                   Lang.bind(this, this._updateDisableUserList));
+
    },
 
+    _ensureUserListLoaded: function() {
+        if (!this._userManager.is_loaded)
+            this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
+                                                                  Lang.bind(this, function() {
+                                                                      if (this._userManager.is_loaded) {
+                                                                          this._loadUserList();
+                                                                          this._userManager.disconnect(this._userManagerLoadedId);
+                                                                          this._userManagerLoadedId = 0;
+                                                                      }
+                                                                  }));
+        else
+            GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
+    },
+
     _updateDisableUserList: function() {
         let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
 
@@ -886,6 +897,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _showUserList: function() {
+        this._ensureUserListLoaded();
         this._authPrompt.hide();
         this._sessionMenuButton.close();
         this._setUserListExpanded(true);
@@ -932,14 +944,17 @@ const LoginDialog = new Lang.Class({
     },
 
     _loadUserList: function() {
+        if (this._userListLoaded)
+            return GLib.SOURCE_REMOVE;
+
+        this._userListLoaded = true;
+
         let users = this._userManager.list_users();
 
         for (let i = 0; i < users.length; i++) {
             this._userList.addUser(users[i]);
         }
 
-        this._updateDisableUserList();
-
         this._userManager.connect('user-added',
                                   Lang.bind(this, function(userManager, user) {
                                       this._userList.addUser(user);
@@ -949,6 +964,8 @@ const LoginDialog = new Lang.Class({
                                   Lang.bind(this, function(userManager, user) {
                                       this._userList.removeUser(user);
                                   }));
+
+        return GLib.SOURCE_REMOVE;
     },
 
     open: function() {
openSUSE Build Service is sponsored by