modal-dialog: Don't let buttons steal manually-set focus

ModalDialog provides a method to set the initial focus. However,
when adding buttons, the initial focus is always set to the last
button, thus overwriting a previously set manual focus.
Instead, only set the initial key focus if setInitialKeyFocus()
has not been called manually before.

https://bugzilla.gnome.org/show_bug.cgi?id=659133
This commit is contained in:
Florian Müllner 2011-09-15 14:02:42 +02:00
parent 2140a498a2
commit 6d92af17fd

View File

@ -131,6 +131,8 @@ ModalDialog.prototype = {
else else
x_alignment = St.Align.MIDDLE; x_alignment = St.Align.MIDDLE;
if (this._initialKeyFocus == this._dialogLayout ||
this._buttonLayout.contains(this._initialKeyFocus))
this._initialKeyFocus = buttonInfo.button; this._initialKeyFocus = buttonInfo.button;
this._buttonLayout.add(buttonInfo.button, this._buttonLayout.add(buttonInfo.button,
{ expand: true, { expand: true,