[gnome-shell] loginDialog: Defer loading user list until needed
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] loginDialog: Defer loading user list until needed
- Date: Fri, 7 Mar 2014 23:32:28 +0000 (UTC)
commit 0ba05b29b9a2420d3e6c0c3cfb2a623aaac9ab2a
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Mar 7 16:04:01 2014 +0100
loginDialog: Defer loading user list until needed
Loading the user list can be expensive, for instance when there is
a large number of users and/or their avatars have to be fetched over
the network. In case the user list is disabled anyway, there is no
point in doing that work just to hide it, so stop doing that.
https://bugzilla.gnome.org/show_bug.cgi?id=725905
js/gdm/loginDialog.js | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 080237c..6e3cb97 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -469,6 +469,17 @@ 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() {
@@ -480,8 +491,7 @@ const LoginDialog = new Lang.Class({
}));
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);
@@ -801,6 +811,7 @@ const LoginDialog = new Lang.Class({
},
_showUserList: function() {
+ this._ensureUserListLoaded();
this._authPrompt.hide();
this._sessionMenuButton.close();
this._setUserListExpanded(true);
@@ -844,14 +855,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]