dialog: Switch to new indentation style

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
This commit is contained in:
Jonas Dreßler 2019-12-05 09:54:38 +01:00 committed by Florian Müllner
parent 5de713b262
commit 259c44395f

View File

@ -25,10 +25,12 @@ class Dialog extends St.Widget {
} }
_createDialog() { _createDialog() {
this._dialog = new St.BoxLayout({ style_class: 'modal-dialog', this._dialog = new St.BoxLayout({
x_align: Clutter.ActorAlign.CENTER, style_class: 'modal-dialog',
y_align: Clutter.ActorAlign.CENTER, x_align: Clutter.ActorAlign.CENTER,
vertical: true }); y_align: Clutter.ActorAlign.CENTER,
vertical: true,
});
// modal dialogs are fixed width and grow vertically; set the request // modal dialogs are fixed width and grow vertically; set the request
// mode accordingly so wrapped labels are handled correctly during // mode accordingly so wrapped labels are handled correctly during
@ -43,7 +45,9 @@ class Dialog extends St.Widget {
}); });
this._dialog.add_child(this.contentLayout); this._dialog.add_child(this.contentLayout);
this.buttonLayout = new St.Widget({ layout_manager: new Clutter.BoxLayout({ homogeneous: true }) }); this.buttonLayout = new St.Widget({
layout_manager: new Clutter.BoxLayout({ homogeneous: true }),
});
this._dialog.add_child(this.buttonLayout); this._dialog.add_child(this.buttonLayout);
} }
@ -111,13 +115,15 @@ class Dialog extends St.Widget {
else else
keys = []; keys = [];
let button = new St.Button({ style_class: 'modal-dialog-linked-button', let button = new St.Button({
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE, style_class: 'modal-dialog-linked-button',
reactive: true, button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
can_focus: true, reactive: true,
x_expand: true, can_focus: true,
y_expand: true, x_expand: true,
label }); y_expand: true,
label,
});
button.connect('clicked', action); button.connect('clicked', action);
buttonInfo['button'] = button; buttonInfo['button'] = button;
@ -144,22 +150,26 @@ class Dialog extends St.Widget {
var MessageDialogContent = GObject.registerClass({ var MessageDialogContent = GObject.registerClass({
Properties: { Properties: {
'icon': GObject.ParamSpec.object('icon', 'icon', 'icon', 'icon': GObject.ParamSpec.object(
GObject.ParamFlags.READWRITE | 'icon', 'icon', 'icon',
GObject.ParamFlags.CONSTRUCT, GObject.ParamFlags.READWRITE |
Gio.Icon.$gtype), GObject.ParamFlags.CONSTRUCT,
'title': GObject.ParamSpec.string('title', 'title', 'title', Gio.Icon.$gtype),
GObject.ParamFlags.READWRITE | 'title': GObject.ParamSpec.string(
GObject.ParamFlags.CONSTRUCT, 'title', 'title', 'title',
null), GObject.ParamFlags.READWRITE |
'subtitle': GObject.ParamSpec.string('subtitle', 'subtitle', 'subtitle', GObject.ParamFlags.CONSTRUCT,
GObject.ParamFlags.READWRITE | null),
GObject.ParamFlags.CONSTRUCT, 'subtitle': GObject.ParamSpec.string(
null), 'subtitle', 'subtitle', 'subtitle',
'body': GObject.ParamSpec.string('body', 'body', 'body', GObject.ParamFlags.READWRITE |
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT,
GObject.ParamFlags.CONSTRUCT, null),
null), 'body': GObject.ParamSpec.string(
'body', 'body', 'body',
GObject.ParamFlags.READWRITE |
GObject.ParamFlags.CONSTRUCT,
null),
}, },
}, class MessageDialogContent extends St.BoxLayout { }, class MessageDialogContent extends St.BoxLayout {
_init(params) { _init(params) {
@ -172,18 +182,21 @@ var MessageDialogContent = GObject.registerClass({
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`); this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
}); });
let textProps = { ellipsize: Pango.EllipsizeMode.NONE, let textProps = {
line_wrap: true }; ellipsize: Pango.EllipsizeMode.NONE,
line_wrap: true,
};
this._subtitle.clutter_text.set(textProps); this._subtitle.clutter_text.set(textProps);
this._body.clutter_text.set(textProps); this._body.clutter_text.set(textProps);
let defaultParams = { style_class: 'message-dialog-main-layout' }; let defaultParams = { style_class: 'message-dialog-main-layout' };
super._init(Object.assign(defaultParams, params)); super._init(Object.assign(defaultParams, params));
this.messageBox = new St.BoxLayout({ style_class: 'message-dialog-content', this.messageBox = new St.BoxLayout({
x_expand: true, style_class: 'message-dialog-content',
vertical: true }); x_expand: true,
vertical: true,
});
this.messageBox.add_actor(this._title); this.messageBox.add_actor(this._title);
this.messageBox.add_actor(this._subtitle); this.messageBox.add_actor(this._subtitle);
this.messageBox.add_actor(this._body); this.messageBox.add_actor(this._body);