dialog: Remove MessageDialogContent.body property
According to the new dialog design, dialogs generally only have a title and a description, so the `body` property is no longer needed. At the places where it's still used, we replace it with the description property or a plain label we add to MessageDialogContent ourselves. See https://gitlab.gnome.org/GNOME/gnome-shell/issues/1343 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
This commit is contained in:
parent
845c52797b
commit
2fc84e0fe3
@ -68,12 +68,12 @@
|
||||
padding-right: 17px;
|
||||
}
|
||||
|
||||
.message-dialog-body {
|
||||
.message-dialog-description {
|
||||
padding-left: 17px;
|
||||
width: 28em;
|
||||
}
|
||||
|
||||
.message-dialog-body:rtl {
|
||||
.message-dialog-description:rtl {
|
||||
padding-left: 0px;
|
||||
padding-right: 17px;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* exported AccessDialogDBus */
|
||||
const { Clutter, Gio, GLib, GObject, Shell } = imports.gi;
|
||||
const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
|
||||
|
||||
const CheckBox = imports.ui.checkBox;
|
||||
const Dialog = imports.ui.dialog;
|
||||
@ -40,8 +40,7 @@ class AccessDialog extends ModalDialog.ModalDialog {
|
||||
let grantLabel = options['grant_label'] || _("Grant Access");
|
||||
let choices = options['choices'] || [];
|
||||
|
||||
let contentParams = { title, description, body };
|
||||
let content = new Dialog.MessageDialogContent(contentParams);
|
||||
let content = new Dialog.MessageDialogContent({ title, description });
|
||||
this.contentLayout.add_actor(content);
|
||||
|
||||
this._choices = new Map();
|
||||
@ -54,11 +53,17 @@ class AccessDialog extends ModalDialog.ModalDialog {
|
||||
let check = new CheckBox.CheckBox();
|
||||
check.getLabelActor().text = name;
|
||||
check.checked = selected == "true";
|
||||
content.insertBeforeBody(check);
|
||||
content.add_child(check);
|
||||
|
||||
this._choices.set(id, check);
|
||||
}
|
||||
|
||||
let bodyLabel = new St.Label({
|
||||
text: body,
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
content.add_child(bodyLabel);
|
||||
|
||||
this.addButton({ label: denyLabel,
|
||||
action: () => {
|
||||
this._sendResponse(DialogResponse.CANCEL);
|
||||
|
@ -25,7 +25,7 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
||||
this.contentLayout.add(this._content);
|
||||
|
||||
this.prompt.bind_property('message', this._content, 'title', GObject.BindingFlags.SYNC_CREATE);
|
||||
this.prompt.bind_property('description', this._content, 'body', GObject.BindingFlags.SYNC_CREATE);
|
||||
this.prompt.bind_property('description', this._content, 'description', GObject.BindingFlags.SYNC_CREATE);
|
||||
|
||||
this._workSpinner = null;
|
||||
this._controlTable = null;
|
||||
|
@ -29,11 +29,10 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
||||
else
|
||||
this._content = this._getContent();
|
||||
|
||||
let contentParams = {
|
||||
let contentBox = new Dialog.MessageDialogContent({
|
||||
title: this._content.title,
|
||||
body: this._content.message,
|
||||
};
|
||||
let contentBox = new Dialog.MessageDialogContent(contentParams);
|
||||
description: this._content.message,
|
||||
});
|
||||
this.contentLayout.add_actor(contentBox);
|
||||
|
||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
|
@ -25,11 +25,11 @@ const DELAYED_RESET_TIMEOUT = 200;
|
||||
var AuthenticationDialog = GObject.registerClass({
|
||||
Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } },
|
||||
}, class AuthenticationDialog extends ModalDialog.ModalDialog {
|
||||
_init(actionId, body, cookie, userNames) {
|
||||
_init(actionId, description, cookie, userNames) {
|
||||
super._init({ styleClass: 'prompt-dialog' });
|
||||
|
||||
this.actionId = actionId;
|
||||
this.message = body;
|
||||
this.message = description;
|
||||
this.userNames = userNames;
|
||||
|
||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
|
||||
@ -40,7 +40,7 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
|
||||
let title = _("Authentication Required");
|
||||
|
||||
let content = new Dialog.MessageDialogContent({ title, body });
|
||||
let content = new Dialog.MessageDialogContent({ title, description });
|
||||
this.contentLayout.add_actor(content);
|
||||
|
||||
if (userNames.length > 1) {
|
||||
|
@ -156,28 +156,14 @@ var MessageDialogContent = GObject.registerClass({
|
||||
GObject.ParamFlags.READWRITE |
|
||||
GObject.ParamFlags.CONSTRUCT,
|
||||
null),
|
||||
'body': GObject.ParamSpec.string(
|
||||
'body', 'body', 'body',
|
||||
GObject.ParamFlags.READWRITE |
|
||||
GObject.ParamFlags.CONSTRUCT,
|
||||
null),
|
||||
},
|
||||
}, class MessageDialogContent extends St.BoxLayout {
|
||||
_init(params) {
|
||||
this._title = new St.Label();
|
||||
this._description = new St.Label();
|
||||
this._body = new St.Label();
|
||||
this._title = new St.Label({ style_class: 'message-dialog-title' });
|
||||
this._description = new St.Label({ style_class: 'message-dialog-description' });
|
||||
|
||||
['title', 'description', 'body'].forEach(prop => {
|
||||
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
|
||||
});
|
||||
|
||||
let textProps = {
|
||||
ellipsize: Pango.EllipsizeMode.NONE,
|
||||
line_wrap: true,
|
||||
};
|
||||
this._description.clutter_text.set(textProps);
|
||||
this._body.clutter_text.set(textProps);
|
||||
this._description.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||
this._description.clutter_text.line_wrap = true;
|
||||
|
||||
let defaultParams = {
|
||||
style_class: 'message-dialog-content',
|
||||
@ -188,7 +174,6 @@ var MessageDialogContent = GObject.registerClass({
|
||||
|
||||
this.add_child(this._title);
|
||||
this.add_child(this._description);
|
||||
this.add_child(this._body);
|
||||
}
|
||||
|
||||
get title() {
|
||||
@ -199,10 +184,6 @@ var MessageDialogContent = GObject.registerClass({
|
||||
return this._description.text;
|
||||
}
|
||||
|
||||
get body() {
|
||||
return this._body.text;
|
||||
}
|
||||
|
||||
set title(title) {
|
||||
this._setLabel(this._title, 'title', title);
|
||||
}
|
||||
@ -211,10 +192,6 @@ var MessageDialogContent = GObject.registerClass({
|
||||
this._setLabel(this._description, 'description', description);
|
||||
}
|
||||
|
||||
set body(body) {
|
||||
this._setLabel(this._body, 'body', body);
|
||||
}
|
||||
|
||||
_setLabel(label, prop, value) {
|
||||
label.set({
|
||||
text: value || '',
|
||||
@ -222,8 +199,4 @@ var MessageDialogContent = GObject.registerClass({
|
||||
});
|
||||
this.notify(prop);
|
||||
}
|
||||
|
||||
insertBeforeBody(actor) {
|
||||
this.messageBox.insert_child_below(actor, this._body);
|
||||
}
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ class KbdA11yDialog extends GObject.Object {
|
||||
|
||||
_showKbdA11yDialog(deviceManager, newFlags, whatChanged) {
|
||||
let dialog = new ModalDialog.ModalDialog();
|
||||
let title, body;
|
||||
let title, description;
|
||||
let key, enabled;
|
||||
|
||||
if (whatChanged & Clutter.KeyboardA11yFlags.SLOW_KEYS_ENABLED) {
|
||||
@ -31,8 +31,8 @@ class KbdA11yDialog extends GObject.Object {
|
||||
title = enabled
|
||||
? _("Slow Keys Turned On")
|
||||
: _("Slow Keys Turned Off");
|
||||
body = _("You just held down the Shift key for 8 seconds. This is the shortcut " +
|
||||
"for the Slow Keys feature, which affects the way your keyboard works.");
|
||||
description = _('You just held down the Shift key for 8 seconds. This is the shortcut ' +
|
||||
'for the Slow Keys feature, which affects the way your keyboard works.');
|
||||
|
||||
} else if (whatChanged & Clutter.KeyboardA11yFlags.STICKY_KEYS_ENABLED) {
|
||||
key = KEY_STICKY_KEYS_ENABLED;
|
||||
@ -40,7 +40,7 @@ class KbdA11yDialog extends GObject.Object {
|
||||
title = enabled
|
||||
? _("Sticky Keys Turned On")
|
||||
: _("Sticky Keys Turned Off");
|
||||
body = enabled
|
||||
description = enabled
|
||||
? _("You just pressed the Shift key 5 times in a row. This is the shortcut " +
|
||||
"for the Sticky Keys feature, which affects the way your keyboard works.")
|
||||
: _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " +
|
||||
@ -49,7 +49,7 @@ class KbdA11yDialog extends GObject.Object {
|
||||
return;
|
||||
}
|
||||
|
||||
let contentParams = { title, body, styleClass: 'access-dialog' };
|
||||
let contentParams = { title, description, styleClass: 'access-dialog' };
|
||||
let content = new Dialog.MessageDialogContent(contentParams);
|
||||
|
||||
dialog.contentLayout.add_actor(content);
|
||||
|
@ -38,7 +38,7 @@ function _setLabelsForMessage(content, message) {
|
||||
let labels = message.split('\n');
|
||||
|
||||
content.title = labels.shift();
|
||||
content.body = labels.join('\n');
|
||||
content.description = labels.join('\n');
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
@ -281,14 +281,13 @@ var ShellMountPasswordDialog = GObject.registerClass({
|
||||
_init(message, flags) {
|
||||
let strings = message.split('\n');
|
||||
let title = strings.shift() || null;
|
||||
let body = strings.shift() || null;
|
||||
let description = strings.shift() || null;
|
||||
super._init({ styleClass: 'prompt-dialog' });
|
||||
|
||||
let disksApp = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
|
||||
|
||||
let content = new Dialog.MessageDialogContent({ title, body });
|
||||
let content = new Dialog.MessageDialogContent({ title, description });
|
||||
this.contentLayout.add_actor(content);
|
||||
content._body.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||
|
||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
let grid = new St.Widget({ style_class: 'prompt-dialog-grid',
|
||||
|
@ -1,7 +1,7 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Indicator */
|
||||
|
||||
const { Clutter, Gio, GLib, GObject, Shell } = imports.gi;
|
||||
const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
|
||||
|
||||
const Dialog = imports.ui.dialog;
|
||||
const Main = imports.ui.main;
|
||||
@ -353,12 +353,16 @@ var GeolocationDialog = GObject.registerClass({
|
||||
|
||||
/* Translators: %s is an application name */
|
||||
let title = _("Give %s access to your location?").format(name);
|
||||
let body = _("Location access can be changed at any time from the privacy settings.");
|
||||
|
||||
let contentParams = { title, description, body };
|
||||
let content = new Dialog.MessageDialogContent(contentParams);
|
||||
let content = new Dialog.MessageDialogContent({ title, description });
|
||||
this.contentLayout.add_actor(content);
|
||||
|
||||
let infoLabel = new St.Label({
|
||||
text: _('Location access can be changed at any time from the privacy settings.'),
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
content.add_child(infoLabel);
|
||||
|
||||
let button = this.addButton({ label: _("Deny Access"),
|
||||
action: this._onDenyClicked.bind(this),
|
||||
key: Clutter.KEY_Escape });
|
||||
|
@ -52,10 +52,10 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
||||
this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
|
||||
|
||||
let title = _("Do you want to keep these display settings?");
|
||||
let body = this._formatCountDown();
|
||||
let description = this._formatCountDown();
|
||||
|
||||
this._content = new Dialog.MessageDialogContent({
|
||||
title, body,
|
||||
title, description,
|
||||
x_expand: true,
|
||||
y_expand: true,
|
||||
});
|
||||
@ -101,7 +101,7 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
this._content.body = this._formatCountDown();
|
||||
this._content.description = this._formatCountDown();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user