dialog: Remove icons from dialogs

According to the new mockups, remove the icon from MessageDialogContent

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:
Jonas Dreßler 2020-01-13 13:39:41 +01:00 committed by Florian Müllner
parent 929c2c3921
commit 5d99bdbe5e
13 changed files with 31 additions and 79 deletions

View File

@ -42,11 +42,6 @@
spacing: 20px; spacing: 20px;
} }
.message-dialog-icon {
min-width: $base_icon_size * 3;
icon-size: $base_icon_size * 3;
}
.message-dialog-title { .message-dialog-title {
font-weight: bold; font-weight: bold;
} }

View File

@ -38,12 +38,9 @@ class AccessDialog extends ModalDialog.ModalDialog {
// 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 iconName = options['icon'] || null;
let choices = options['choices'] || []; let choices = options['choices'] || [];
let contentParams = { title, subtitle, body }; let contentParams = { title, subtitle, body };
if (iconName)
contentParams.icon = new Gio.ThemedIcon({ name: iconName });
let content = new Dialog.MessageDialogContent(contentParams); let content = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);

View File

@ -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 CloseDialog */ /* exported CloseDialog */
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
const Dialog = imports.ui.dialog; const Dialog = imports.ui.dialog;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -42,8 +42,7 @@ var CloseDialog = GObject.registerClass({
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 subtitle = _("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.");
let icon = new Gio.ThemedIcon({ name: 'dialog-warning-symbolic' }); return new Dialog.MessageDialogContent({ title, subtitle });
return new Dialog.MessageDialogContent({ icon, title, subtitle });
} }
_updateScale() { _updateScale() {

View File

@ -21,8 +21,7 @@ class KeyringDialog extends ModalDialog.ModalDialog {
this.prompt.connect('show-confirm', this._onShowConfirm.bind(this)); this.prompt.connect('show-confirm', this._onShowConfirm.bind(this));
this.prompt.connect('prompt-close', this._onHidePrompt.bind(this)); this.prompt.connect('prompt-close', this._onHidePrompt.bind(this));
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' }); this._content = new Dialog.MessageDialogContent();
this._content = new Dialog.MessageDialogContent({ icon });
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);

View File

@ -29,10 +29,10 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
else else
this._content = this._getContent(); this._content = this._getContent();
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' }); let contentParams = {
let contentParams = { icon,
title: this._content.title, title: this._content.title,
body: this._content.message }; body: this._content.message,
};
let contentBox = new Dialog.MessageDialogContent(contentParams); let contentBox = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(contentBox); this.contentLayout.add_actor(contentBox);

View File

@ -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 Component */ /* exported Component */
const { AccountsService, Clutter, Gio, GLib, const { AccountsService, Clutter, GLib,
GObject, Pango, PolkitAgent, Polkit, Shell, St } = imports.gi; GObject, Pango, PolkitAgent, Polkit, Shell, St } = imports.gi;
const Animation = imports.ui.animation; const Animation = imports.ui.animation;
@ -38,10 +38,9 @@ var AuthenticationDialog = GObject.registerClass({
this.connect('closed', this._onDialogClosed.bind(this)); this.connect('closed', this._onDialogClosed.bind(this));
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' });
let title = _("Authentication Required"); let title = _("Authentication Required");
let content = new Dialog.MessageDialogContent({ icon, title, body }); let content = new Dialog.MessageDialogContent({ title, body });
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);
if (userNames.length > 1) { if (userNames.length > 1) {

View File

@ -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 Dialog, MessageDialogContent */ /* exported Dialog, MessageDialogContent */
const { Clutter, Gio, GObject, Pango, St } = imports.gi; const { Clutter, GObject, Pango, St } = imports.gi;
var Dialog = GObject.registerClass( var Dialog = GObject.registerClass(
class Dialog extends St.Widget { class Dialog extends St.Widget {
@ -146,11 +146,6 @@ class Dialog extends St.Widget {
var MessageDialogContent = GObject.registerClass({ var MessageDialogContent = GObject.registerClass({
Properties: { Properties: {
'icon': GObject.ParamSpec.object(
'icon', 'icon', 'icon',
GObject.ParamFlags.READWRITE |
GObject.ParamFlags.CONSTRUCT,
Gio.Icon.$gtype),
'title': GObject.ParamSpec.string( 'title': GObject.ParamSpec.string(
'title', 'title', 'title', 'title', 'title', 'title',
GObject.ParamFlags.READWRITE | GObject.ParamFlags.READWRITE |
@ -169,12 +164,11 @@ var MessageDialogContent = GObject.registerClass({
}, },
}, class MessageDialogContent extends St.BoxLayout { }, class MessageDialogContent extends St.BoxLayout {
_init(params) { _init(params) {
this._icon = new St.Icon({ y_align: Clutter.ActorAlign.START }); this._title = new St.Label();
this._title = new St.Label({ style_class: 'headline' });
this._subtitle = new St.Label(); this._subtitle = new St.Label();
this._body = new St.Label(); this._body = new St.Label();
['icon', 'title', 'subtitle', 'body'].forEach(prop => { ['title', 'subtitle', 'body'].forEach(prop => {
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`); this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
}); });
@ -196,15 +190,9 @@ var MessageDialogContent = GObject.registerClass({
this.messageBox.add_actor(this._title); this.messageBox.add_actor(this._title);
this.messageBox.add_actor(this._subtitle); this.messageBox.add_actor(this._subtitle);
this.messageBox.add_actor(this._body); this.messageBox.add_actor(this._body);
this.add_actor(this._icon);
this.add_actor(this.messageBox); this.add_actor(this.messageBox);
} }
get icon() {
return this._icon.gicon;
}
get title() { get title() {
return this._title.text; return this._title.text;
} }
@ -217,14 +205,6 @@ var MessageDialogContent = GObject.registerClass({
return this._body.text; return this._body.text;
} }
set icon(icon) {
this._icon.set({
gicon: icon,
visible: icon != null,
});
this.notify('icon');
}
set title(title) { set title(title) {
this._setLabel(this._title, 'title', title); this._setLabel(this._title, 'title', title);
} }

View File

@ -198,9 +198,6 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
let content = new Dialog.MessageDialogContent({ let content = new Dialog.MessageDialogContent({
title: _("Download and install “%s” from extensions.gnome.org?").format(info.name), title: _("Download and install “%s” from extensions.gnome.org?").format(info.name),
icon: new Gio.FileIcon({
file: Gio.File.new_for_uri(`${REPOSITORY_URL_BASE}${info.icon}`),
}),
}); });
this.contentLayout.add(content); this.contentLayout.add(content);

View File

@ -79,9 +79,8 @@ var InhibitShortcutsDialog = GObject.registerClass({
let title = name let title = name
? _("%s wants to inhibit shortcuts").format(name) ? _("%s wants to inhibit shortcuts").format(name)
: _("Application wants to inhibit shortcuts"); : _("Application wants to inhibit shortcuts");
let icon = new Gio.ThemedIcon({ name: 'dialog-warning-symbolic' });
let contentParams = { icon, title }; let contentParams = { title };
let restoreAccel = this._getRestoreAccel(); let restoreAccel = this._getRestoreAccel();
if (restoreAccel) { if (restoreAccel) {

View File

@ -49,8 +49,7 @@ class KbdA11yDialog extends GObject.Object {
return; return;
} }
let icon = new Gio.ThemedIcon({ name: 'preferences-desktop-accessibility-symbolic' }); let contentParams = { title, body, styleClass: 'access-dialog' };
let contentParams = { icon, title, body, 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);

View File

@ -99,8 +99,6 @@ var ShellMountOperation = class {
this.close.bind(this)); this.close.bind(this));
this.mountOp.connect('show-unmount-progress', this.mountOp.connect('show-unmount-progress',
this._onShowUnmountProgress.bind(this)); this._onShowUnmountProgress.bind(this));
this._gicon = source.get_icon();
} }
_closeExistingDialog() { _closeExistingDialog() {
@ -113,7 +111,7 @@ var ShellMountOperation = class {
_onAskQuestion(op, message, choices) { _onAskQuestion(op, message, choices) {
this._closeExistingDialog(); this._closeExistingDialog();
this._dialog = new ShellMountQuestionDialog(this._gicon); this._dialog = new ShellMountQuestionDialog();
this._dialogId = this._dialog.connect('response', this._dialogId = this._dialog.connect('response',
(object, choice) => { (object, choice) => {
@ -132,7 +130,7 @@ var ShellMountOperation = class {
this._dialog = this._existingDialog; this._dialog = this._existingDialog;
this._dialog.reaskPassword(); this._dialog.reaskPassword();
} else { } else {
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags); this._dialog = new ShellMountPasswordDialog(message, flags);
} }
this._dialogId = this._dialog.connect('response', this._dialogId = this._dialog.connect('response',
@ -178,7 +176,7 @@ var ShellMountOperation = class {
let message = op.get_show_processes_message(); let message = op.get_show_processes_message();
if (!this._processesDialog) { if (!this._processesDialog) {
this._processesDialog = new ShellProcessesDialog(this._gicon); this._processesDialog = new ShellProcessesDialog();
this._dialog = this._processesDialog; this._dialog = this._processesDialog;
this._dialogId = this._processesDialog.connect('response', this._dialogId = this._processesDialog.connect('response',
@ -259,10 +257,10 @@ class ShellUnmountNotifier extends MessageTray.Source {
var ShellMountQuestionDialog = GObject.registerClass({ var ShellMountQuestionDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_INT] } }, Signals: { 'response': { param_types: [GObject.TYPE_INT] } },
}, class ShellMountQuestionDialog extends ModalDialog.ModalDialog { }, class ShellMountQuestionDialog extends ModalDialog.ModalDialog {
_init(icon) { _init() {
super._init({ styleClass: 'mount-dialog' }); super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon }); this._content = new Dialog.MessageDialogContent();
this.contentLayout.add_child(this._content); this.contentLayout.add_child(this._content);
} }
@ -280,7 +278,7 @@ var ShellMountPasswordDialog = GObject.registerClass({
GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN,
GObject.TYPE_UINT] } }, GObject.TYPE_UINT] } },
}, class ShellMountPasswordDialog extends ModalDialog.ModalDialog { }, class ShellMountPasswordDialog extends ModalDialog.ModalDialog {
_init(message, icon, 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 body = strings.shift() || null;
@ -288,7 +286,7 @@ var ShellMountPasswordDialog = GObject.registerClass({
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({ icon, title, body }); let content = new Dialog.MessageDialogContent({ title, body });
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);
content._body.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; content._body.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
@ -498,10 +496,10 @@ var ShellMountPasswordDialog = GObject.registerClass({
var ShellProcessesDialog = GObject.registerClass({ var ShellProcessesDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_INT] } }, Signals: { 'response': { param_types: [GObject.TYPE_INT] } },
}, class ShellProcessesDialog extends ModalDialog.ModalDialog { }, class ShellProcessesDialog extends ModalDialog.ModalDialog {
_init(icon) { _init() {
super._init({ styleClass: 'mount-dialog' }); super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon }); this._content = new Dialog.MessageDialogContent();
this.contentLayout.add_child(this._content); this.contentLayout.add_child(this._content);
let scrollView = new St.ScrollView({ let scrollView = new St.ScrollView({
@ -617,12 +615,6 @@ var GnomeShellMountOpHandler = class {
} }
} }
_createGIcon(iconName) {
let realIconName = iconName ? iconName : 'drive-harddisk';
return new Gio.ThemedIcon({ name: realIconName,
use_default_fallbacks: true });
}
/** /**
* AskPassword: * AskPassword:
* @param {Array} params * @param {Array} params
@ -649,7 +641,7 @@ var GnomeShellMountOpHandler = class {
* attempt went wrong. * attempt went wrong.
*/ */
AskPasswordAsync(params, invocation) { AskPasswordAsync(params, invocation) {
let [id, message, iconName, defaultUser_, defaultDomain_, flags] = params; let [id, message, iconName_, defaultUser_, defaultDomain_, flags] = params;
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) { if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) {
this._dialog.reaskPassword(); this._dialog.reaskPassword();
@ -658,7 +650,7 @@ var GnomeShellMountOpHandler = class {
this._closeDialog(); this._closeDialog();
this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags); this._dialog = new ShellMountPasswordDialog(message, flags);
this._dialog.connect('response', this._dialog.connect('response',
(object, choice, password, remember, hiddenVolume, systemVolume, pim) => { (object, choice, password, remember, hiddenVolume, systemVolume, pim) => {
let details = {}; let details = {};
@ -699,7 +691,7 @@ var GnomeShellMountOpHandler = class {
* update the dialog with the new question. * update the dialog with the new question.
*/ */
AskQuestionAsync(params, invocation) { AskQuestionAsync(params, invocation) {
let [id, message, iconName, choices] = params; let [id, message, iconName_, choices] = params;
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_QUESTION)) { if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_QUESTION)) {
this._dialog.update(message, choices); this._dialog.update(message, choices);
@ -708,7 +700,7 @@ var GnomeShellMountOpHandler = class {
this._closeDialog(); this._closeDialog();
this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message); this._dialog = new ShellMountQuestionDialog(message);
this._dialog.connect('response', (object, choice) => { this._dialog.connect('response', (object, choice) => {
this._clearCurrentRequest(Gio.MountOperationResult.HANDLED, this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
{ choice: GLib.Variant.new('i', choice) }); { choice: GLib.Variant.new('i', choice) });
@ -737,7 +729,7 @@ var GnomeShellMountOpHandler = class {
* of processes. * of processes.
*/ */
ShowProcessesAsync(params, invocation) { ShowProcessesAsync(params, invocation) {
let [id, message, iconName, applicationPids, choices] = params; let [id, message, iconName_, applicationPids, choices] = params;
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.SHOW_PROCESSES)) { if (this._setCurrentRequest(invocation, id, ShellMountOperationType.SHOW_PROCESSES)) {
this._dialog.update(message, applicationPids, choices); this._dialog.update(message, applicationPids, choices);
@ -746,7 +738,7 @@ var GnomeShellMountOpHandler = class {
this._closeDialog(); this._closeDialog();
this._dialog = new ShellProcessesDialog(this._createGIcon(iconName)); this._dialog = new ShellProcessesDialog();
this._dialog.connect('response', (object, choice) => { this._dialog.connect('response', (object, choice) => {
let response; let response;
let details = {}; let details = {};

View File

@ -351,13 +351,11 @@ var GeolocationDialog = GObject.registerClass({
super._init({ styleClass: 'geolocation-dialog' }); super._init({ styleClass: 'geolocation-dialog' });
this.reqAccuracyLevel = reqAccuracyLevel; this.reqAccuracyLevel = reqAccuracyLevel;
let icon = new Gio.ThemedIcon({ name: 'find-location-symbolic' });
/* 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 body = _("Location access can be changed at any time from the privacy settings.");
let contentParams = { icon, title, subtitle, body }; let contentParams = { title, subtitle, body };
let content = new Dialog.MessageDialogContent(contentParams); let content = new Dialog.MessageDialogContent(contentParams);
this.contentLayout.add_actor(content); this.contentLayout.add_actor(content);

View File

@ -51,13 +51,11 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
this._countDown = Meta.MonitorManager.get_display_configuration_timeout(); this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
let iconName = 'preferences-desktop-display-symbolic';
let icon = new Gio.ThemedIcon({ name: iconName });
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 body = this._formatCountDown();
this._content = new Dialog.MessageDialogContent({ this._content = new Dialog.MessageDialogContent({
icon, title, body, title, body,
x_expand: true, x_expand: true,
y_expand: true, y_expand: true,
}); });