loginDialog: Move long session-list menus to the side

Currently the menu position below the button means that the menu
can extend to roughly half the screen height before ending up partly
off-screen. This is plenty of space for commonly installed sessions,
but some users have a significantly higher number of sessions in the
list. Move the menu to the side of the button in that case to maximize
the vertical space the menu may take up.

https://bugzilla.gnome.org/show_bug.cgi?id=734352
This commit is contained in:
Florian Müllner 2015-03-20 14:29:40 +01:00
parent ef6e8f5bb2
commit 9934529a0b

View File

@ -49,6 +49,7 @@ const _FADE_ANIMATION_TIME = 0.25;
const _SCROLL_ANIMATION_TIME = 0.5;
const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
const _LOGO_ICON_HEIGHT = 48;
const _MAX_BOTTOM_MENU_ITEMS = 5;
const UserListItem = new Lang.Class({
Name: 'UserListItem',
@ -283,7 +284,16 @@ const SessionMenuButton = new Lang.Class({
this.actor = new St.Bin({ child: this._button });
this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.TOP);
let side = St.Side.TOP;
let align = 0;
if (Gdm.get_session_ids().length > _MAX_BOTTOM_MENU_ITEMS) {
if (this.actor.text_direction == Clutter.TextDirection.RTL)
side = St.Side.RIGHT;
else
side = St.Side.LEFT;
align = 0.5;
}
this._menu = new PopupMenu.PopupMenu(this._button, align, side);
Main.uiGroup.add_actor(this._menu.actor);
this._menu.actor.hide();