modalDialog: Hide button layout by default

For modal dialogs without buttons, the button group still contributes
padding/spacing. To fix that, hide it by default and only show it
when actually adding buttons.

https://bugzilla.gnome.org/show_bug.cgi?id=668209
This commit is contained in:
Florian Müllner 2012-02-28 16:53:46 +01:00
parent 714ffc5ef1
commit 760da64a4c

View File

@ -87,6 +87,7 @@ const ModalDialog = new Lang.Class({
y_align: St.Align.START }); y_align: St.Align.START });
this._buttonLayout = new St.BoxLayout({ style_class: 'modal-dialog-button-box', this._buttonLayout = new St.BoxLayout({ style_class: 'modal-dialog-button-box',
visible: false,
vertical: false }); vertical: false });
this._dialogLayout.add(this._buttonLayout, this._dialogLayout.add(this._buttonLayout,
{ expand: true, { expand: true,
@ -108,6 +109,8 @@ const ModalDialog = new Lang.Class({
this._buttonLayout.destroy_all_children(); this._buttonLayout.destroy_all_children();
this._actionKeys = {}; this._actionKeys = {};
this._buttonLayout.visible = (buttons.length > 0);
for (let i = 0; i < buttons.length; i++) { for (let i = 0; i < buttons.length; i++) {
let buttonInfo = buttons[i]; let buttonInfo = buttons[i];
let label = buttonInfo['label']; let label = buttonInfo['label'];