From f0e5fb04fc7872b2fd0e8d6445ebc752ac858f3b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 16 Aug 2013 19:43:04 -0400 Subject: [PATCH] popupMenu: Remove PopupMenuAlternatingMenuItem It's now unused. --- js/ui/popupMenu.js | 99 ---------------------------------------------- 1 file changed, 99 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 2ac169b4e..524aab56b 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',