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;
|
padding-right: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-dialog-body {
|
.message-dialog-description {
|
||||||
padding-left: 17px;
|
padding-left: 17px;
|
||||||
width: 28em;
|
width: 28em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-dialog-body:rtl {
|
.message-dialog-description:rtl {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 17px;
|
padding-right: 17px;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* exported AccessDialogDBus */
|
/* 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 CheckBox = imports.ui.checkBox;
|
||||||
const Dialog = imports.ui.dialog;
|
const Dialog = imports.ui.dialog;
|
||||||
@ -40,8 +40,7 @@ class AccessDialog extends ModalDialog.ModalDialog {
|
|||||||
let grantLabel = options['grant_label'] || _("Grant Access");
|
let grantLabel = options['grant_label'] || _("Grant Access");
|
||||||
let choices = options['choices'] || [];
|
let choices = options['choices'] || [];
|
||||||
|
|
||||||
let contentParams = { title, description, body };
|
let content = new Dialog.MessageDialogContent({ title, description });
|
||||||
let content = new Dialog.MessageDialogContent(contentParams);
|
|
||||||
this.contentLayout.add_actor(content);
|
this.contentLayout.add_actor(content);
|
||||||
|
|
||||||
this._choices = new Map();
|
this._choices = new Map();
|
||||||
@ -54,11 +53,17 @@ class AccessDialog extends ModalDialog.ModalDialog {
|
|||||||
let check = new CheckBox.CheckBox();
|
let check = new CheckBox.CheckBox();
|
||||||
check.getLabelActor().text = name;
|
check.getLabelActor().text = name;
|
||||||
check.checked = selected == "true";
|
check.checked = selected == "true";
|
||||||
content.insertBeforeBody(check);
|
content.add_child(check);
|
||||||
|
|
||||||
this._choices.set(id, 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,
|
this.addButton({ label: denyLabel,
|
||||||
action: () => {
|
action: () => {
|
||||||
this._sendResponse(DialogResponse.CANCEL);
|
this._sendResponse(DialogResponse.CANCEL);
|
||||||
|
@ -25,7 +25,7 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
|||||||
this.contentLayout.add(this._content);
|
this.contentLayout.add(this._content);
|
||||||
|
|
||||||
this.prompt.bind_property('message', this._content, 'title', GObject.BindingFlags.SYNC_CREATE);
|
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._workSpinner = null;
|
||||||
this._controlTable = null;
|
this._controlTable = null;
|
||||||
|
@ -29,11 +29,10 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
|||||||
else
|
else
|
||||||
this._content = this._getContent();
|
this._content = this._getContent();
|
||||||
|
|
||||||
let contentParams = {
|
let contentBox = new Dialog.MessageDialogContent({
|
||||||
title: this._content.title,
|
title: this._content.title,
|
||||||
body: this._content.message,
|
description: this._content.message,
|
||||||
};
|
});
|
||||||
let contentBox = new Dialog.MessageDialogContent(contentParams);
|
|
||||||
this.contentLayout.add_actor(contentBox);
|
this.contentLayout.add_actor(contentBox);
|
||||||
|
|
||||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
|
@ -25,11 +25,11 @@ const DELAYED_RESET_TIMEOUT = 200;
|
|||||||
var AuthenticationDialog = GObject.registerClass({
|
var AuthenticationDialog = GObject.registerClass({
|
||||||
Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } },
|
Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } },
|
||||||
}, class AuthenticationDialog extends ModalDialog.ModalDialog {
|
}, class AuthenticationDialog extends ModalDialog.ModalDialog {
|
||||||
_init(actionId, body, cookie, userNames) {
|
_init(actionId, description, cookie, userNames) {
|
||||||
super._init({ styleClass: 'prompt-dialog' });
|
super._init({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this.actionId = actionId;
|
this.actionId = actionId;
|
||||||
this.message = body;
|
this.message = description;
|
||||||
this.userNames = userNames;
|
this.userNames = userNames;
|
||||||
|
|
||||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
|
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
|
||||||
@ -40,7 +40,7 @@ var AuthenticationDialog = GObject.registerClass({
|
|||||||
|
|
||||||
let title = _("Authentication Required");
|
let title = _("Authentication Required");
|
||||||
|
|
||||||
let content = new Dialog.MessageDialogContent({ title, body });
|
let content = new Dialog.MessageDialogContent({ title, description });
|
||||||
this.contentLayout.add_actor(content);
|
this.contentLayout.add_actor(content);
|
||||||
|
|
||||||
if (userNames.length > 1) {
|
if (userNames.length > 1) {
|
||||||
|
@ -156,28 +156,14 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
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) {
|
||||||
this._title = new St.Label();
|
this._title = new St.Label({ style_class: 'message-dialog-title' });
|
||||||
this._description = new St.Label();
|
this._description = new St.Label({ style_class: 'message-dialog-description' });
|
||||||
this._body = new St.Label();
|
|
||||||
|
|
||||||
['title', 'description', 'body'].forEach(prop => {
|
this._description.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
|
this._description.clutter_text.line_wrap = true;
|
||||||
});
|
|
||||||
|
|
||||||
let textProps = {
|
|
||||||
ellipsize: Pango.EllipsizeMode.NONE,
|
|
||||||
line_wrap: true,
|
|
||||||
};
|
|
||||||
this._description.clutter_text.set(textProps);
|
|
||||||
this._body.clutter_text.set(textProps);
|
|
||||||
|
|
||||||
let defaultParams = {
|
let defaultParams = {
|
||||||
style_class: 'message-dialog-content',
|
style_class: 'message-dialog-content',
|
||||||
@ -188,7 +174,6 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
|
|
||||||
this.add_child(this._title);
|
this.add_child(this._title);
|
||||||
this.add_child(this._description);
|
this.add_child(this._description);
|
||||||
this.add_child(this._body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
@ -199,10 +184,6 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
return this._description.text;
|
return this._description.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
get body() {
|
|
||||||
return this._body.text;
|
|
||||||
}
|
|
||||||
|
|
||||||
set title(title) {
|
set title(title) {
|
||||||
this._setLabel(this._title, 'title', title);
|
this._setLabel(this._title, 'title', title);
|
||||||
}
|
}
|
||||||
@ -211,10 +192,6 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
this._setLabel(this._description, 'description', description);
|
this._setLabel(this._description, 'description', description);
|
||||||
}
|
}
|
||||||
|
|
||||||
set body(body) {
|
|
||||||
this._setLabel(this._body, 'body', body);
|
|
||||||
}
|
|
||||||
|
|
||||||
_setLabel(label, prop, value) {
|
_setLabel(label, prop, value) {
|
||||||
label.set({
|
label.set({
|
||||||
text: value || '',
|
text: value || '',
|
||||||
@ -222,8 +199,4 @@ var MessageDialogContent = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
this.notify(prop);
|
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) {
|
_showKbdA11yDialog(deviceManager, newFlags, whatChanged) {
|
||||||
let dialog = new ModalDialog.ModalDialog();
|
let dialog = new ModalDialog.ModalDialog();
|
||||||
let title, body;
|
let title, description;
|
||||||
let key, enabled;
|
let key, enabled;
|
||||||
|
|
||||||
if (whatChanged & Clutter.KeyboardA11yFlags.SLOW_KEYS_ENABLED) {
|
if (whatChanged & Clutter.KeyboardA11yFlags.SLOW_KEYS_ENABLED) {
|
||||||
@ -31,8 +31,8 @@ class KbdA11yDialog extends GObject.Object {
|
|||||||
title = enabled
|
title = enabled
|
||||||
? _("Slow Keys Turned On")
|
? _("Slow Keys Turned On")
|
||||||
: _("Slow Keys Turned Off");
|
: _("Slow Keys Turned Off");
|
||||||
body = _("You just held down the Shift key for 8 seconds. This is the shortcut " +
|
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.");
|
'for the Slow Keys feature, which affects the way your keyboard works.');
|
||||||
|
|
||||||
} else if (whatChanged & Clutter.KeyboardA11yFlags.STICKY_KEYS_ENABLED) {
|
} else if (whatChanged & Clutter.KeyboardA11yFlags.STICKY_KEYS_ENABLED) {
|
||||||
key = KEY_STICKY_KEYS_ENABLED;
|
key = KEY_STICKY_KEYS_ENABLED;
|
||||||
@ -40,7 +40,7 @@ class KbdA11yDialog extends GObject.Object {
|
|||||||
title = enabled
|
title = enabled
|
||||||
? _("Sticky Keys Turned On")
|
? _("Sticky Keys Turned On")
|
||||||
: _("Sticky Keys Turned Off");
|
: _("Sticky Keys Turned Off");
|
||||||
body = enabled
|
description = enabled
|
||||||
? _("You just pressed the Shift key 5 times in a row. This is the shortcut " +
|
? _("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.")
|
"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. " +
|
: _("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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let contentParams = { title, body, styleClass: 'access-dialog' };
|
let contentParams = { title, description, styleClass: 'access-dialog' };
|
||||||
let content = new Dialog.MessageDialogContent(contentParams);
|
let content = new Dialog.MessageDialogContent(contentParams);
|
||||||
|
|
||||||
dialog.contentLayout.add_actor(content);
|
dialog.contentLayout.add_actor(content);
|
||||||
|
@ -38,7 +38,7 @@ function _setLabelsForMessage(content, message) {
|
|||||||
let labels = message.split('\n');
|
let labels = message.split('\n');
|
||||||
|
|
||||||
content.title = labels.shift();
|
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) {
|
_init(message, flags) {
|
||||||
let strings = message.split('\n');
|
let strings = message.split('\n');
|
||||||
let title = strings.shift() || null;
|
let title = strings.shift() || null;
|
||||||
let body = strings.shift() || null;
|
let description = strings.shift() || null;
|
||||||
super._init({ styleClass: 'prompt-dialog' });
|
super._init({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
let disksApp = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
|
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);
|
this.contentLayout.add_actor(content);
|
||||||
content._body.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
||||||
|
|
||||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
let grid = new St.Widget({ style_class: 'prompt-dialog-grid',
|
let grid = new St.Widget({ style_class: 'prompt-dialog-grid',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported Indicator */
|
/* 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 Dialog = imports.ui.dialog;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -353,12 +353,16 @@ var GeolocationDialog = GObject.registerClass({
|
|||||||
|
|
||||||
/* Translators: %s is an application name */
|
/* Translators: %s is an application name */
|
||||||
let title = _("Give %s access to your location?").format(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({ title, description });
|
||||||
let content = new Dialog.MessageDialogContent(contentParams);
|
|
||||||
this.contentLayout.add_actor(content);
|
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"),
|
let button = this.addButton({ label: _("Deny Access"),
|
||||||
action: this._onDenyClicked.bind(this),
|
action: this._onDenyClicked.bind(this),
|
||||||
key: Clutter.KEY_Escape });
|
key: Clutter.KEY_Escape });
|
||||||
|
@ -52,10 +52,10 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
|||||||
this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
|
this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
|
||||||
|
|
||||||
let title = _("Do you want to keep these display settings?");
|
let title = _("Do you want to keep these display settings?");
|
||||||
let body = this._formatCountDown();
|
let description = this._formatCountDown();
|
||||||
|
|
||||||
this._content = new Dialog.MessageDialogContent({
|
this._content = new Dialog.MessageDialogContent({
|
||||||
title, body,
|
title, description,
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_expand: true,
|
y_expand: true,
|
||||||
});
|
});
|
||||||
@ -101,7 +101,7 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._content.body = this._formatCountDown();
|
this._content.description = this._formatCountDown();
|
||||||
return GLib.SOURCE_CONTINUE;
|
return GLib.SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user