dialog: Rename subtitle property to description

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/886
This commit is contained in:
Jonas Dreßler 2020-01-13 14:07:28 +01:00 committed by Florian Müllner
parent 48f1c4b9d7
commit 845c52797b
6 changed files with 24 additions and 24 deletions

View File

@ -43,7 +43,7 @@
font-weight: bold; font-weight: bold;
} }
.message-dialog-subtitle { .message-dialog-description {
color: $fg_color; color: $fg_color;
font-weight: bold; font-weight: bold;
} }

View File

@ -18,7 +18,7 @@ var DialogResponse = {
var AccessDialog = GObject.registerClass( var AccessDialog = GObject.registerClass(
class AccessDialog extends ModalDialog.ModalDialog { class AccessDialog extends ModalDialog.ModalDialog {
_init(invocation, handle, title, subtitle, body, options) { _init(invocation, handle, title, description, body, options) {
super._init({ styleClass: 'access-dialog' }); super._init({ styleClass: 'access-dialog' });
this._invocation = invocation; this._invocation = invocation;
@ -30,17 +30,17 @@ class AccessDialog extends ModalDialog.ModalDialog {
for (let option in options) for (let option in options)
options[option] = options[option].deep_unpack(); options[option] = options[option].deep_unpack();
this._buildLayout(title, subtitle, body, options); this._buildLayout(title, description, body, options);
} }
_buildLayout(title, subtitle, body, options) { _buildLayout(title, description, body, options) {
// No support for non-modal system dialogs, so ignore the option // No support for non-modal system dialogs, so ignore the option
// let modal = options['modal'] || true; // let modal = options['modal'] || true;
let denyLabel = options['deny_label'] || _("Deny Access"); let denyLabel = options['deny_label'] || _("Deny Access");
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, subtitle, body }; let contentParams = { title, description, body };
let content = new Dialog.MessageDialogContent(contentParams); let content = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);
@ -130,7 +130,7 @@ var AccessDialogDBus = class {
return; return;
} }
let [handle, appId, parentWindow_, title, subtitle, body, options] = params; let [handle, appId, parentWindow_, title, description, body, options] = params;
// We probably want to use parentWindow and global.display.focus_window // We probably want to use parentWindow and global.display.focus_window
// for this check in the future // for this check in the future
if (appId && `${appId}.desktop` != this._windowTracker.focus_app.id) { if (appId && `${appId}.desktop` != this._windowTracker.focus_app.id) {
@ -140,8 +140,8 @@ var AccessDialogDBus = class {
return; return;
} }
let dialog = new AccessDialog(invocation, handle, title, let dialog = new AccessDialog(
subtitle, body, options); invocation, handle, title, description, body, options);
dialog.open(); dialog.open();
dialog.connect('closed', () => (this._accessDialog = null)); dialog.connect('closed', () => (this._accessDialog = null));

View File

@ -40,9 +40,9 @@ var CloseDialog = GObject.registerClass({
/* Translators: %s is an application name */ /* Translators: %s is an application name */
let title = _("“%s” is not responding.").format(windowApp.get_name()); let title = _("“%s” is not responding.").format(windowApp.get_name());
let subtitle = _("You may choose to wait a short while for it to " + let description = _('You may choose to wait a short while for it to ' +
"continue or force the application to quit entirely."); 'continue or force the application to quit entirely.');
return new Dialog.MessageDialogContent({ title, subtitle }); return new Dialog.MessageDialogContent({ title, description });
} }
_updateScale() { _updateScale() {

View File

@ -151,8 +151,8 @@ var MessageDialogContent = GObject.registerClass({
GObject.ParamFlags.READWRITE | GObject.ParamFlags.READWRITE |
GObject.ParamFlags.CONSTRUCT, GObject.ParamFlags.CONSTRUCT,
null), null),
'subtitle': GObject.ParamSpec.string( 'description': GObject.ParamSpec.string(
'subtitle', 'subtitle', 'subtitle', 'description', 'description', 'description',
GObject.ParamFlags.READWRITE | GObject.ParamFlags.READWRITE |
GObject.ParamFlags.CONSTRUCT, GObject.ParamFlags.CONSTRUCT,
null), null),
@ -165,10 +165,10 @@ var MessageDialogContent = GObject.registerClass({
}, class MessageDialogContent extends St.BoxLayout { }, class MessageDialogContent extends St.BoxLayout {
_init(params) { _init(params) {
this._title = new St.Label(); this._title = new St.Label();
this._subtitle = new St.Label(); this._description = new St.Label();
this._body = new St.Label(); this._body = new St.Label();
['title', 'subtitle', 'body'].forEach(prop => { ['title', 'description', 'body'].forEach(prop => {
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`); this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
}); });
@ -176,7 +176,7 @@ var MessageDialogContent = GObject.registerClass({
ellipsize: Pango.EllipsizeMode.NONE, ellipsize: Pango.EllipsizeMode.NONE,
line_wrap: true, line_wrap: true,
}; };
this._subtitle.clutter_text.set(textProps); this._description.clutter_text.set(textProps);
this._body.clutter_text.set(textProps); this._body.clutter_text.set(textProps);
let defaultParams = { let defaultParams = {
@ -187,7 +187,7 @@ var MessageDialogContent = GObject.registerClass({
super._init(Object.assign(defaultParams, params)); super._init(Object.assign(defaultParams, params));
this.add_child(this._title); this.add_child(this._title);
this.add_child(this._subtitle); this.add_child(this._description);
this.add_child(this._body); this.add_child(this._body);
} }
@ -195,8 +195,8 @@ var MessageDialogContent = GObject.registerClass({
return this._title.text; return this._title.text;
} }
get subtitle() { get description() {
return this._subtitle.text; return this._description.text;
} }
get body() { get body() {
@ -207,8 +207,8 @@ var MessageDialogContent = GObject.registerClass({
this._setLabel(this._title, 'title', title); this._setLabel(this._title, 'title', title);
} }
set subtitle(subtitle) { set description(description) {
this._setLabel(this._subtitle, 'subtitle', subtitle); this._setLabel(this._description, 'description', description);
} }
set body(body) { set body(body) {

View File

@ -84,7 +84,7 @@ var InhibitShortcutsDialog = GObject.registerClass({
let restoreAccel = this._getRestoreAccel(); let restoreAccel = this._getRestoreAccel();
if (restoreAccel) { if (restoreAccel) {
contentParams.subtitle = contentParams.description =
/* Translators: %s is a keyboard shortcut like "Super+x" */ /* Translators: %s is a keyboard shortcut like "Super+x" */
_("You can restore shortcuts by pressing %s.").format(restoreAccel); _("You can restore shortcuts by pressing %s.").format(restoreAccel);
} }

View File

@ -347,7 +347,7 @@ var AppAuthorizer = class {
var GeolocationDialog = GObject.registerClass({ var GeolocationDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_UINT] } }, Signals: { 'response': { param_types: [GObject.TYPE_UINT] } },
}, class GeolocationDialog extends ModalDialog.ModalDialog { }, class GeolocationDialog extends ModalDialog.ModalDialog {
_init(name, subtitle, reqAccuracyLevel) { _init(name, description, reqAccuracyLevel) {
super._init({ styleClass: 'geolocation-dialog' }); super._init({ styleClass: 'geolocation-dialog' });
this.reqAccuracyLevel = reqAccuracyLevel; this.reqAccuracyLevel = reqAccuracyLevel;
@ -355,7 +355,7 @@ var GeolocationDialog = GObject.registerClass({
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 body = _("Location access can be changed at any time from the privacy settings.");
let contentParams = { title, subtitle, body }; let contentParams = { title, description, body };
let content = new Dialog.MessageDialogContent(contentParams); let content = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);