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

@ -94,9 +94,9 @@ var PopupBaseMenuItem = GObject.registerClass({
});
this._delegate = this;
this._ornament = Ornament.NONE;
this._ornamentIcon = new St.Icon({style_class: 'popup-menu-ornament'});
this.add(this._ornamentIcon);
this.setOrnament(Ornament.NONE);
this._parent = null;
this._active = false;
@ -256,6 +256,14 @@ var PopupBaseMenuItem = GObject.registerClass({
}
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');
}
});