[gnome-shell/wip/background-rework: 12/13] loginDialog: put "Not Listed?" button and user list in separate container



commit c5943b51990a4f9190a3050cc1117141ce103ff2
Author: Ray Strode <rstrode redhat com>
Date:   Wed Feb 6 16:37:47 2013 -0500

    loginDialog: put "Not Listed?" button and user list in separate container
    
    The user list and the "Not Listed?" button get shown and hidden at the
    same time, so we can simplify the code by putting them in a new
    subcontainer.
    
    This commit creates a userSelectionBox container that both actors get
    put in, and changes all the code that shows and hides these actors to
    show and hide userSelectionBox instead.

 js/gdm/loginDialog.js |   70 +++++++++++++++++-------------------------------
 1 files changed, 25 insertions(+), 45 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 5df550f..50bd419 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -216,38 +216,18 @@ const UserList = new Lang.Class({
         this.emit('activate', activatedItem);
     },
 
-    hideItemsExcept: function(exception) {
-        for (let userName in this._items) {
-            let item = this._items[userName];
-
-            item.actor.set_hover(false);
-            item.actor.reactive = false;
-            item.actor.can_focus = false;
-            item.syncStyleClasses();
-            item._timedLoginIndicator.scale_x = 0.;
-            if (item != exception)
-                item.actor.hide();
-        }
-
-        this._box.remove_style_pseudo_class('expanded');
-    },
-
-    hideItems: function() {
-        return this.hideItemsExcept(null);
-    },
-
-    showItems: function() {
+    updateStyle: function(isExpanded) {
         let tasks = [];
 
-        this._box.add_style_pseudo_class('expanded');
+        if (isExpanded)
+            this._box.add_style_pseudo_class('expanded');
+        else
+            this._box.remove_style_pseudo_class('expanded');
 
         for (let userName in this._items) {
             let item = this._items[userName];
             item.actor.sync_hover();
-            item.actor.reactive = true;
-            item.actor.can_focus = true;
             item.syncStyleClasses();
-            item.actor.show();
         }
     },
 
@@ -569,16 +549,20 @@ const LoginDialog = new Lang.Class({
         this._settings.connect('changed::' + GdmUtil.DISABLE_USER_LIST_KEY,
                                Lang.bind(this, this._updateDisableUserList));
 
+        this._userSelectionBox = new St.BoxLayout({ style_class: 'login-dialog-user-selection-box',
+                                                    vertical: true });
+        this.contentLayout.add(this._userSelectionBox);
+
         this._bannerLabel = new St.Label({ style_class: 'login-dialog-banner',
                                            text: '' });
-        this.contentLayout.add(this._bannerLabel);
+        this._userSelectionBox.add(this._bannerLabel);
         this._updateBanner();
 
         this._userList = new UserList();
-        this.contentLayout.add(this._userList.actor,
-                               { expand: true,
-                                 x_fill: true,
-                                 y_fill: true });
+        this._userSelectionBox.add(this._userList.actor,
+                                   { expand: true,
+                                     x_fill: true,
+                                     y_fill: true });
 
         this.setInitialKeyFocus(this._userList.actor);
 
@@ -648,10 +632,10 @@ const LoginDialog = new Lang.Class({
 
         this._notListedButton.connect('clicked', Lang.bind(this, this._hideUserListAndLogIn));
 
-        this.contentLayout.add(this._notListedButton,
-                               { expand: false,
-                                 x_align: St.Align.START,
-                                 x_fill: true });
+        this._userSelectionBox.add(this._notListedButton,
+                                   { expand: false,
+                                     x_align: St.Align.START,
+                                     x_fill: true });
 
         if (!this._userManager.is_loaded)
             this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
@@ -1060,9 +1044,9 @@ const LoginDialog = new Lang.Class({
     },
 
     _hideUserListAndLogIn: function() {
-        this._userList.hideItems();
-        this._userList.actor.hide();
-        this._notListedButton.hide();
+        this._userSelectionBox.hide();
+        this._userList.updateStyle(false);
+
         let tasks = [function() {
                          return this._askForUsernameAndLogIn();
                      }];
@@ -1075,11 +1059,8 @@ const LoginDialog = new Lang.Class({
         this._hidePrompt();
         this._sessionList.close();
         this._promptLoginHint.hide();
-        this._userList.actor.show();
-        this._userList.actor.opacity = 255;
-        this._notListedButton.show();
-        this._userList.showItems();
-        this._userList.actor.reactive = true;
+        this._userSelectionBox.show();
+        this._userList.updateStyle(true);
         this._userList.actor.grab_key_focus();
     },
 
@@ -1104,9 +1085,8 @@ const LoginDialog = new Lang.Class({
 
         this._setPromptUserFromItem(activatedItem);
 
-        this._userList.actor.reactive = false;
-        this._userList.hideItems();
-        this._notListedButton.hide();
+        this._userSelectionBox.hide();
+        this._userList.updateStyle(false);
 
         let tasks = [function() {
                          let userName = activatedItem.user.get_user_name();


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