cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace it for better readability and to prepare for an eventual port to ES6 classes. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:

committed by
Florian Müllner

parent
cff0b81f32
commit
76f09b1e49
@ -19,7 +19,7 @@ const PopupMenu = imports.ui.popupMenu;
|
||||
var AltSwitcher = new Lang.Class({
|
||||
Name: 'AltSwitcher',
|
||||
|
||||
_init: function(standard, alternate) {
|
||||
_init(standard, alternate) {
|
||||
this._standard = standard;
|
||||
this._standard.connect('notify::visible', Lang.bind(this, this._sync));
|
||||
if (this._standard instanceof St.Button)
|
||||
@ -44,7 +44,7 @@ var AltSwitcher = new Lang.Class({
|
||||
this.actor.connect('notify::mapped', () => { this._flipped = false; });
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let childToShow = null;
|
||||
|
||||
if (this._standard.visible && this._alternate.visible) {
|
||||
@ -82,14 +82,14 @@ var AltSwitcher = new Lang.Class({
|
||||
this.actor.visible = (childToShow != null);
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
if (this._capturedEventId > 0) {
|
||||
global.stage.disconnect(this._capturedEventId);
|
||||
this._capturedEventId = 0;
|
||||
}
|
||||
},
|
||||
|
||||
_onCapturedEvent: function(actor, event) {
|
||||
_onCapturedEvent(actor, event) {
|
||||
let type = event.type();
|
||||
if (type == Clutter.EventType.KEY_PRESS || type == Clutter.EventType.KEY_RELEASE) {
|
||||
let key = event.get_key_symbol();
|
||||
@ -100,7 +100,7 @@ var AltSwitcher = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_onLongPress: function(action, actor, state) {
|
||||
_onLongPress(action, actor, state) {
|
||||
if (state == Clutter.LongPressState.QUERY ||
|
||||
state == Clutter.LongPressState.CANCEL)
|
||||
return true;
|
||||
@ -115,7 +115,7 @@ var Indicator = new Lang.Class({
|
||||
Name: 'SystemIndicator',
|
||||
Extends: PanelMenu.SystemIndicator,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
let userManager = AccountsService.UserManager.get_default();
|
||||
@ -146,7 +146,7 @@ var Indicator = new Lang.Class({
|
||||
this._sessionUpdated();
|
||||
},
|
||||
|
||||
_updateActionsVisibility: function() {
|
||||
_updateActionsVisibility() {
|
||||
let visible = (this._settingsAction.visible ||
|
||||
this._orientationLockAction.visible ||
|
||||
this._lockScreenAction.visible ||
|
||||
@ -155,18 +155,18 @@ var Indicator = new Lang.Class({
|
||||
this._actionsItem.actor.visible = visible;
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
this._settingsAction.visible = Main.sessionMode.allowSettings;
|
||||
},
|
||||
|
||||
_updateMultiUser: function() {
|
||||
_updateMultiUser() {
|
||||
let hasSwitchUser = this._loginScreenItem.actor.visible;
|
||||
let hasLogout = this._logoutItem.actor.visible;
|
||||
|
||||
this._switchUserSubMenu.actor.visible = hasSwitchUser || hasLogout;
|
||||
},
|
||||
|
||||
_updateSwitchUserSubMenu: function() {
|
||||
_updateSwitchUserSubMenu() {
|
||||
this._switchUserSubMenu.label.text = this._user.get_real_name();
|
||||
let clutterText = this._switchUserSubMenu.label.clutter_text;
|
||||
|
||||
@ -199,7 +199,7 @@ var Indicator = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_createActionButton: function(iconName, accessibleName) {
|
||||
_createActionButton(iconName, accessibleName) {
|
||||
let icon = new St.Button({ reactive: true,
|
||||
can_focus: true,
|
||||
track_hover: true,
|
||||
@ -209,7 +209,7 @@ var Indicator = new Lang.Class({
|
||||
return icon;
|
||||
},
|
||||
|
||||
_createSubMenu: function() {
|
||||
_createSubMenu() {
|
||||
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
|
||||
let item;
|
||||
|
||||
@ -329,7 +329,7 @@ var Indicator = new Lang.Class({
|
||||
() => { this._updateActionsVisibility(); });
|
||||
},
|
||||
|
||||
_onSettingsClicked: function() {
|
||||
_onSettingsClicked() {
|
||||
this.menu.itemActivated();
|
||||
let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop');
|
||||
Main.overview.hide();
|
||||
|
Reference in New Issue
Block a user