popupMenu: Use correct padding for items with hidden ornaments

This also restores the padding adjustments that were erroneously removed
in a0fde0ee, but now they only apply to ornamented items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2843>
This commit is contained in:
Sebastian Keller 2023-05-17 22:49:34 +02:00 committed by Marge Bot
parent 6a3dfbee8b
commit ad34082fd1
2 changed files with 13 additions and 1 deletions

View File

@ -53,6 +53,10 @@ $submenu_bg_color: lighten($menu_bg_color, 7%);
} }
} }
.popup-ornamented-menu-item {
&:ltr {padding-left: $base_padding;}
&:rtl {padding-right: $base_padding;}
}
// all other graphical elements (sliders) // all other graphical elements (sliders)
.popup-inactive-menu-item { .popup-inactive-menu-item {

View File

@ -94,9 +94,9 @@ var PopupBaseMenuItem = GObject.registerClass({
}); });
this._delegate = this; this._delegate = this;
this._ornament = Ornament.NONE;
this._ornamentIcon = new St.Icon({style_class: 'popup-menu-ornament'}); this._ornamentIcon = new St.Icon({style_class: 'popup-menu-ornament'});
this.add(this._ornamentIcon); this.add(this._ornamentIcon);
this.setOrnament(Ornament.NONE);
this._parent = null; this._parent = null;
this._active = false; this._active = false;
@ -256,6 +256,14 @@ var PopupBaseMenuItem = GObject.registerClass({
} }
this._ornamentIcon.visible = ornament !== Ornament.HIDDEN; this._ornamentIcon.visible = ornament !== Ornament.HIDDEN;
this._updateOrnamentStyle();
}
_updateOrnamentStyle() {
if (this._ornament !== Ornament.HIDDEN)
this.add_style_class_name('popup-ornamented-menu-item');
else
this.remove_style_class_name('popup-ornamented-menu-item');
} }
}); });