sessionList: always allocate full height

This helps to prevent stuff from jumping around on the login dialog
when the session list opens.
This commit is contained in:
Ray Strode 2013-06-19 09:15:05 -04:00
parent 9451c04a09
commit 9a0d0d2fd3

View File

@ -117,17 +117,29 @@ const SessionList = new Lang.Class({
this._itemList = new St.BoxLayout({ style_class: 'login-dialog-session-item-list',
vertical: true });
this._scrollView.add_actor(this._itemList);
this._scrollView.hide();
this._hideSessions();
this.isOpen = false;
this._populate();
},
_hideSessions: function() {
this._itemList.can_focus = false;
this._itemList.reactive = false;
this._scrollView.opacity = 0;
},
_showSessions: function() {
this._scrollView.opacity = 255;
this._itemList.reactive = true;
this._itemList.can_focus = true;
},
open: function() {
if (this.isOpen)
return;
this._button.add_style_pseudo_class('open');
this._scrollView.show();
this._showSessions();
this._triangle.set_text('\u25BE');
this.isOpen = true;
@ -138,7 +150,7 @@ const SessionList = new Lang.Class({
return;
this._button.remove_style_pseudo_class('open');
this._scrollView.hide();
this._hideSessions();
this._triangle.set_text('\u25B8');
this.isOpen = false;
@ -202,6 +214,16 @@ const SessionList = new Lang.Class({
Lang.bind(this, function() {
this.setActiveSession(item.id);
}));
item.actor.can_focus = this._itemList.can_focus;
let signalId = this._itemList.connect('notify::can-focus',
Lang.bind(this, function() {
item.actor.can_focus = this._itemList.can_focus;
}));
item.actor.connect('destroy',
Lang.bind(this, function() {
this._itemList.disconnect(signalId);
}));
}
}
});