popupMenu: Add a check ornament

This will be used to replace switches in the remote menu

https://bugzilla.gnome.org/show_bug.cgi?id=698427
This commit is contained in:
Jasper St. Pierre 2013-04-19 21:13:37 -04:00
parent a123ec94ef
commit 8430353389

View File

@ -22,6 +22,7 @@ const SLIDER_SCROLL_STEP = 0.05; /* Slider scrolling step in % */
const Ornament = { const Ornament = {
NONE: 0, NONE: 0,
DOT: 1, DOT: 1,
CHECK: 2,
}; };
function _ensureStyle(actor) { function _ensureStyle(actor) {
@ -192,6 +193,9 @@ const PopupBaseMenuItem = new Lang.Class({
if (ornament == Ornament.DOT) { if (ornament == Ornament.DOT) {
this._ornamentLabel.text = '\u2022'; this._ornamentLabel.text = '\u2022';
this.actor.add_accessible_state(Atk.StateType.CHECKED); this.actor.add_accessible_state(Atk.StateType.CHECKED);
} else if (ornament == Ornament.CHECK) {
this._ornamentLabel.text = '\u2713';
this.actor.add_accessible_state(Atk.StateType.CHECKED);
} else if (ornament == Ornament.NONE) { } else if (ornament == Ornament.NONE) {
this._ornamentLabel.text = ''; this._ornamentLabel.text = '';
this.actor.remove_accessible_state(Atk.StateType.CHECKED); this.actor.remove_accessible_state(Atk.StateType.CHECKED);