[gnome-shell] popupMenu: Remove PopupMenuAlternatingMenuItem
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popupMenu: Remove PopupMenuAlternatingMenuItem
- Date: Sat, 17 Aug 2013 00:12:05 +0000 (UTC)
commit f0e5fb04fc7872b2fd0e8d6445ebc752ac858f3b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Aug 16 19:43:04 2013 -0400
popupMenu: Remove PopupMenuAlternatingMenuItem
It's now unused.
js/ui/popupMenu.js | 99 ----------------------------------------------------
1 files changed, 0 insertions(+), 99 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 2ac169b..524aab5 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -211,105 +211,6 @@ const PopupSeparatorMenuItem = new Lang.Class({
}
});
-const PopupAlternatingMenuItemState = {
- DEFAULT: 0,
- ALTERNATIVE: 1
-}
-
-const PopupAlternatingMenuItem = new Lang.Class({
- Name: 'PopupAlternatingMenuItem',
- Extends: PopupBaseMenuItem,
-
- _init: function(text, alternateText, params) {
- this.parent(params);
- this.actor.add_style_class_name('popup-alternating-menu-item');
-
- this._text = text;
- this._alternateText = alternateText;
- this.label = new St.Label({ text: text });
- this.state = PopupAlternatingMenuItemState.DEFAULT;
- this.actor.add_child(this.label);
- this.actor.label_actor = this.label;
-
- this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
- },
-
- _onMapped: function() {
- if (this.actor.mapped) {
- this._capturedEventId = global.stage.connect('captured-event',
- Lang.bind(this, this._onCapturedEvent));
- this._updateStateFromModifiers();
- } else {
- if (this._capturedEventId != 0) {
- global.stage.disconnect(this._capturedEventId);
- this._capturedEventId = 0;
- }
- }
- },
-
- _setState: function(state) {
- if (this.state != state) {
- if (state == PopupAlternatingMenuItemState.ALTERNATIVE && !this._canAlternate())
- return;
-
- this.state = state;
- this._updateLabel();
- }
- },
-
- _updateStateFromModifiers: function() {
- let [x, y, mods] = global.get_pointer();
- let state;
-
- if ((mods & Clutter.ModifierType.MOD1_MASK) == 0) {
- state = PopupAlternatingMenuItemState.DEFAULT;
- } else {
- state = PopupAlternatingMenuItemState.ALTERNATIVE;
- }
-
- this._setState(state);
- },
-
- _onCapturedEvent: function(actor, event) {
- if (event.type() != Clutter.EventType.KEY_PRESS &&
- event.type() != Clutter.EventType.KEY_RELEASE)
- return false;
-
- let key = event.get_key_symbol();
-
- if (key == Clutter.KEY_Alt_L || key == Clutter.KEY_Alt_R)
- this._updateStateFromModifiers();
-
- return false;
- },
-
- _updateLabel: function() {
- if (this.state == PopupAlternatingMenuItemState.ALTERNATIVE) {
- this.actor.add_style_pseudo_class('alternate');
- this.label.set_text(this._alternateText);
- } else {
- this.actor.remove_style_pseudo_class('alternate');
- this.label.set_text(this._text);
- }
- },
-
- _canAlternate: function() {
- if (this.state == PopupAlternatingMenuItemState.DEFAULT && !this._alternateText)
- return false;
- return true;
- },
-
- updateText: function(text, alternateText) {
- this._text = text;
- this._alternateText = alternateText;
-
- if (!this._canAlternate())
- this._setState(PopupAlternatingMenuItemState.DEFAULT);
-
- this._updateLabel();
- }
-});
-
const Switch = new Lang.Class({
Name: 'Switch',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]