summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Dreßler <verdre@v0yd.nl>2020-01-13 14:04:40 +0100
committerFlorian Müllner <fmuellner@gnome.org>2020-01-15 00:17:25 +0100
commit2fc84e0fe3f735fd35d678bfeb92ca4c655aa1ae (patch)
treed4a89221281117cb47254af513ad17dcdf63b284
parent845c52797b4ec6890a2fab804903b11318139680 (diff)
downloadgnome-shell-2fc84e0fe3f735fd35d678bfeb92ca4c655aa1ae.tar.gz
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
-rw-r--r--data/theme/gnome-shell-sass/widgets/_dialogs.scss4
-rw-r--r--js/ui/accessDialog.js13
-rw-r--r--js/ui/components/keyring.js2
-rw-r--r--js/ui/components/networkAgent.js7
-rw-r--r--js/ui/components/polkitAgent.js6
-rw-r--r--js/ui/dialog.js35
-rw-r--r--js/ui/kbdA11yDialog.js10
-rw-r--r--js/ui/shellMountOperation.js7
-rw-r--r--js/ui/status/location.js12
-rw-r--r--js/ui/windowManager.js6
10 files changed, 41 insertions, 61 deletions
diff --git a/data/theme/gnome-shell-sass/widgets/_dialogs.scss b/data/theme/gnome-shell-sass/widgets/_dialogs.scss
index 2697e07b1..8ccd9a01f 100644
--- a/data/theme/gnome-shell-sass/widgets/_dialogs.scss
+++ b/data/theme/gnome-shell-sass/widgets/_dialogs.scss
@@ -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;
}
diff --git a/js/ui/accessDialog.js b/js/ui/accessDialog.js
index e0fc8a179..6d3ede01e 100644
--- a/js/ui/accessDialog.js
+++ b/js/ui/accessDialog.js
@@ -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);
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
index 606c00405..4ad55531b 100644
--- a/js/ui/components/keyring.js
+++ b/js/ui/components/keyring.js
@@ -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;
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 2e5b075b2..6351630d4 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -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 });
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
index d9c8bfc0a..8aea29724 100644
--- a/js/ui/components/polkitAgent.js
+++ b/js/ui/components/polkitAgent.js
@@ -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) {
diff --git a/js/ui/dialog.js b/js/ui/dialog.js
index f8fca5655..dfa656230 100644
--- a/js/ui/dialog.js
+++ b/js/ui/dialog.js
@@ -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);
- }
});
diff --git a/js/ui/kbdA11yDialog.js b/js/ui/kbdA11yDialog.js
index 2baedeefa..158f29367 100644
--- a/js/ui/kbdA11yDialog.js
+++ b/js/ui/kbdA11yDialog.js
@@ -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);
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index db1e313cd..7a2150ba9 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -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',
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index e9754bc5b..5829fa9ae 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -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 });
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index be0587527..629fbc21a 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -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;
}