system: Always use default avatar in switch-user submenu

It is too small to be really useful, and sticks out being the
only color icon.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/957
This commit is contained in:
Florian Müllner 2019-02-05 13:55:14 +01:00 committed by Florian Müllner
parent c1d3e304cb
commit 33e05f5912
2 changed files with 6 additions and 25 deletions

View File

@ -1080,11 +1080,7 @@ StScrollBar {
// a little unstructured mess: // a little unstructured mess:
.system-switch-user-submenu-icon.user-icon { .system-switch-user-submenu-icon {
icon-size: 20px;
padding: 0 2px;
}
.system-switch-user-submenu-icon.default-icon {
icon-size: 16px; icon-size: 16px;
padding: 0 4px; padding: 0 4px;
} }

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { AccountsService, Clutter, Gio, GLib, GObject, Shell, St } = imports.gi; const { AccountsService, Clutter, GLib, GObject, Shell, St } = imports.gi;
const BoxPointer = imports.ui.boxpointer; const BoxPointer = imports.ui.boxpointer;
const SystemActions = imports.misc.systemActions; const SystemActions = imports.misc.systemActions;
@ -169,24 +169,6 @@ var Indicator = class extends PanelMenu.SystemIndicator {
let layout = clutterText.get_layout(); let layout = clutterText.get_layout();
if (layout.is_ellipsized()) if (layout.is_ellipsized())
this._switchUserSubMenu.label.text = this._user.get_user_name(); this._switchUserSubMenu.label.text = this._user.get_user_name();
let iconFile = this._user.get_icon_file();
if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
iconFile = null;
if (iconFile) {
let file = Gio.File.new_for_path(iconFile);
let gicon = new Gio.FileIcon({ file: file });
this._switchUserSubMenu.icon.gicon = gicon;
this._switchUserSubMenu.icon.add_style_class_name('user-icon');
this._switchUserSubMenu.icon.remove_style_class_name('default-icon');
} else {
this._switchUserSubMenu.icon.icon_name = 'avatar-default-symbolic';
this._switchUserSubMenu.icon.add_style_class_name('default-icon');
this._switchUserSubMenu.icon.remove_style_class_name('user-icon');
}
} }
_createActionButton(iconName, accessibleName) { _createActionButton(iconName, accessibleName) {
@ -204,7 +186,10 @@ var Indicator = class extends PanelMenu.SystemIndicator {
let item; let item;
this._switchUserSubMenu = new PopupMenu.PopupSubMenuMenuItem('', true); this._switchUserSubMenu = new PopupMenu.PopupSubMenuMenuItem('', true);
this._switchUserSubMenu.icon.style_class = 'system-switch-user-submenu-icon'; this._switchUserSubMenu.icon.set({
icon_name: 'avatar-default-symbolic',
style_class: 'system-switch-user-submenu-icon'
});
// Since the label of the switch user submenu depends on the width of // Since the label of the switch user submenu depends on the width of
// the popup menu, and we can't easily connect on allocation-changed // the popup menu, and we can't easily connect on allocation-changed