popupBaseMenuItem: Add support for Hidden Ornament
The menu item ornament is used to put dots or checks in menus or otherwise to define a padding for a label. However in some cases we want to create a menu item with no left (in ltr) padding. In order to do that, define a HIDDEN Ornament mode that completely hides the ornament actor. The naming here might be confusing as this should probably be called NONE, while the default mode is the invisible one, but it's too late to change it now. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/720
This commit is contained in:
parent
d6ba6dc554
commit
af1aabff75
@ -15,6 +15,7 @@ var Ornament = {
|
|||||||
NONE: 0,
|
NONE: 0,
|
||||||
DOT: 1,
|
DOT: 1,
|
||||||
CHECK: 2,
|
CHECK: 2,
|
||||||
|
HIDDEN: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
function isPopupMenuItemVisible(child) {
|
function isPopupMenuItemVisible(child) {
|
||||||
@ -248,10 +249,12 @@ var PopupBaseMenuItem = GObject.registerClass({
|
|||||||
} else if (ornament == Ornament.CHECK) {
|
} else if (ornament == Ornament.CHECK) {
|
||||||
this._ornamentLabel.text = '\u2713';
|
this._ornamentLabel.text = '\u2713';
|
||||||
this.add_accessible_state(Atk.StateType.CHECKED);
|
this.add_accessible_state(Atk.StateType.CHECKED);
|
||||||
} else if (ornament == Ornament.NONE) {
|
} else if (ornament == Ornament.NONE || ornament == Ornament.HIDDEN) {
|
||||||
this._ornamentLabel.text = '';
|
this._ornamentLabel.text = '';
|
||||||
this.remove_accessible_state(Atk.StateType.CHECKED);
|
this.remove_accessible_state(Atk.StateType.CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._ornamentLabel.visible = ornament != Ornament.HIDDEN;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user