ui: Use MessageDialogContent where appropriate

The gros of our ModalDialogs follow a UI pattern that matches the
newly added widget, so port them over to cut down on duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=784985
This commit is contained in:
Florian Müllner
2017-07-15 06:03:55 +02:00
parent f77333e4d7
commit 593b4318a3
10 changed files with 130 additions and 431 deletions

View File

@ -12,6 +12,7 @@ const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Config = imports.misc.config;
const Dialog = imports.ui.dialog;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
const ModalDialog = imports.ui.modalDialog;
@ -38,41 +39,12 @@ const NetworkSecretDialog = new Lang.Class({
else
this._content = this._getContent();
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
vertical: false });
this.contentLayout.add(mainContentBox,
{ x_fill: true,
y_fill: true });
let icon = new St.Icon({ icon_name: 'dialog-password-symbolic' });
mainContentBox.add(icon,
{ x_fill: true,
y_fill: false,
x_align: St.Align.END,
y_align: St.Align.START });
let messageBox = new St.BoxLayout({ style_class: 'prompt-dialog-message-layout',
vertical: true });
mainContentBox.add(messageBox,
{ y_align: St.Align.START });
let subjectLabel = new St.Label({ style_class: 'prompt-dialog-headline headline',
text: this._content.title });
messageBox.add(subjectLabel,
{ y_fill: false,
y_align: St.Align.START });
if (this._content.message != null) {
let descriptionLabel = new St.Label({ style_class: 'prompt-dialog-description',
text: this._content.message });
descriptionLabel.clutter_text.line_wrap = true;
descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
messageBox.add(descriptionLabel,
{ y_fill: true,
y_align: St.Align.START,
expand: true });
}
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' });
let contentParams = { icon,
title: this._content.title,
body: this._content.message };
let contentBox = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(contentBox);
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
let secretTable = new St.Widget({ style_class: 'network-dialog-secret-table',
@ -135,7 +107,7 @@ const NetworkSecretDialog = new Lang.Class({
secret.entry.clutter_text.set_password_char('\u25cf');
}
messageBox.add(secretTable);
contentBox.messageBox.add(secretTable);
this._okButton = { label: _("Connect"),
action: Lang.bind(this, this._onOk),