[gnome-shell] popupMenu: minor code rearrangement
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popupMenu: minor code rearrangement
- Date: Tue, 8 Feb 2011 21:09:23 +0000 (UTC)
commit 5eb28e162f85e49ffb38bf81873cba77b588eb0d
Author: Dan Winship <danw gnome org>
Date: Tue Feb 8 14:19:04 2011 -0500
popupMenu: minor code rearrangement
Move the Switch class to right before PopupSwitchMenuItem (and add
some missing semicolons).
js/ui/popupMenu.js | 63 +++++++++++++++++++++++++--------------------------
1 files changed, 31 insertions(+), 32 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 30f353e..14b1450 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -18,35 +18,6 @@ const _ = Gettext.gettext;
const SLIDER_SCROLL_STEP = 0.05; /* Slider scrolling step in % */
-function Switch() {
- this._init.apply(this, arguments);
-}
-
-Switch.prototype = {
- _init: function(state) {
- this.actor = new St.Bin({ style_class: 'toggle-switch' });
- // Translators: this MUST be either "toggle-switch-us"
- // (for toggle switches containing the English words
- // "ON" and "OFF") or "toggle-switch-intl" (for toggle
- // switches containing "â?¯" and "|"). Other values will
- // simply result in invisible toggle switches.
- this.actor.add_style_class_name(_("toggle-switch-us"));
- this.setToggleState(state);
- },
-
- setToggleState: function(state) {
- if (state)
- this.actor.add_style_pseudo_class('checked');
- else
- this.actor.remove_style_pseudo_class('checked');
- this.state = state;
- },
-
- toggle: function() {
- this.setToggleState(!this.state);
- }
-};
-
function PopupBaseMenuItem(params) {
this._init(params);
}
@@ -483,7 +454,7 @@ PopupSliderMenuItem.prototype = {
_motionEvent: function(actor, event) {
let absX, absY;
[absX, absY] = event.get_coords();
- this._moveHandle(absX, absY)
+ this._moveHandle(absX, absY);
return true;
},
@@ -524,8 +495,37 @@ PopupSliderMenuItem.prototype = {
}
return false;
}
+};
+
+function Switch() {
+ this._init.apply(this, arguments);
}
+Switch.prototype = {
+ _init: function(state) {
+ this.actor = new St.Bin({ style_class: 'toggle-switch' });
+ // Translators: this MUST be either "toggle-switch-us"
+ // (for toggle switches containing the English words
+ // "ON" and "OFF") or "toggle-switch-intl" (for toggle
+ // switches containing "â?¯" and "|"). Other values will
+ // simply result in invisible toggle switches.
+ this.actor.add_style_class_name(_("toggle-switch-us"));
+ this.setToggleState(state);
+ },
+
+ setToggleState: function(state) {
+ if (state)
+ this.actor.add_style_pseudo_class('checked');
+ else
+ this.actor.remove_style_pseudo_class('checked');
+ this.state = state;
+ },
+
+ toggle: function() {
+ this.setToggleState(!this.state);
+ }
+};
+
function PopupSwitchMenuItem() {
this._init.apply(this, arguments);
}
@@ -559,8 +559,7 @@ PopupSwitchMenuItem.prototype = {
setToggleState: function(state) {
this._switch.setToggleState(state);
}
-}
-
+};
function PopupImageMenuItem(text, iconName) {
this._init(text, iconName);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]