cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base to bind `this` to anonymous functions, replacing the more overbose Lang.bind(this, function() {}). https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:

committed by
Florian Müllner

parent
76f09b1e49
commit
213e38c2ef
@ -93,7 +93,7 @@ var ATIndicator = new Lang.Class({
|
||||
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
|
||||
let items = this.menu._getMenuItems();
|
||||
|
||||
this.actor.visible = alwaysShow || items.some(function(f) { return !!f.state; });
|
||||
this.actor.visible = alwaysShow || items.some(f => !!f.state);
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
@ -111,7 +111,7 @@ var ATIndicator = new Lang.Class({
|
||||
if (!writable)
|
||||
widget.actor.reactive = false;
|
||||
else
|
||||
widget.connect('toggled', function(item) {
|
||||
widget.connect('toggled', item => {
|
||||
on_set(item.state);
|
||||
});
|
||||
return widget;
|
||||
@ -119,25 +119,23 @@ var ATIndicator = new Lang.Class({
|
||||
|
||||
_buildItem(string, schema, key) {
|
||||
let settings = new Gio.Settings({ schema_id: schema });
|
||||
settings.connect('changed::'+key, Lang.bind(this, function() {
|
||||
settings.connect('changed::'+key, () => {
|
||||
widget.setToggleState(settings.get_boolean(key));
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
});
|
||||
|
||||
let widget = this._buildItemExtended(string,
|
||||
settings.get_boolean(key),
|
||||
settings.is_writable(key),
|
||||
function(enabled) {
|
||||
return settings.set_boolean(key, enabled);
|
||||
});
|
||||
enabled => settings.set_boolean(key, enabled));
|
||||
return widget;
|
||||
},
|
||||
|
||||
_buildHCItem() {
|
||||
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
||||
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
|
||||
interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
|
||||
interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
|
||||
let value = interfaceSettings.get_string(KEY_GTK_THEME);
|
||||
if (value == HIGH_CONTRAST_THEME) {
|
||||
highContrast.setToggleState(true);
|
||||
@ -147,13 +145,13 @@ var ATIndicator = new Lang.Class({
|
||||
}
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() {
|
||||
});
|
||||
interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
|
||||
let value = interfaceSettings.get_string(KEY_ICON_THEME);
|
||||
if (value != HIGH_CONTRAST_THEME)
|
||||
iconTheme = value;
|
||||
});
|
||||
wmSettings.connect('changed::' + KEY_WM_THEME, function() {
|
||||
wmSettings.connect('changed::' + KEY_WM_THEME, () => {
|
||||
let value = wmSettings.get_string(KEY_WM_THEME);
|
||||
if (value != HIGH_CONTRAST_THEME)
|
||||
wmTheme = value;
|
||||
@ -169,7 +167,7 @@ var ATIndicator = new Lang.Class({
|
||||
interfaceSettings.is_writable(KEY_GTK_THEME) &&
|
||||
interfaceSettings.is_writable(KEY_ICON_THEME) &&
|
||||
wmSettings.is_writable(KEY_WM_THEME),
|
||||
function (enabled) {
|
||||
enabled => {
|
||||
if (enabled) {
|
||||
interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
|
||||
interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
|
||||
@ -189,20 +187,20 @@ var ATIndicator = new Lang.Class({
|
||||
|
||||
_buildFontItem() {
|
||||
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
||||
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
|
||||
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, () => {
|
||||
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
|
||||
let active = (factor > 1.0);
|
||||
widget.setToggleState(active);
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
});
|
||||
|
||||
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
|
||||
let initial_setting = (factor > 1.0);
|
||||
let widget = this._buildItemExtended(_("Large Text"),
|
||||
initial_setting,
|
||||
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
|
||||
function (enabled) {
|
||||
enabled => {
|
||||
if (enabled)
|
||||
settings.set_double(KEY_TEXT_SCALING_FACTOR,
|
||||
DPI_FACTOR_LARGE);
|
||||
|
@ -35,23 +35,23 @@ var Indicator = new Lang.Class({
|
||||
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
|
||||
|
||||
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
|
||||
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true);
|
||||
this._item.icon.icon_name = 'bluetooth-active-symbolic';
|
||||
|
||||
this._toggleItem = new PopupMenu.PopupMenuItem('');
|
||||
this._toggleItem.connect('activate', Lang.bind(this, function() {
|
||||
this._toggleItem.connect('activate', () => {
|
||||
this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode;
|
||||
}));
|
||||
});
|
||||
this._item.menu.addMenuItem(this._toggleItem);
|
||||
|
||||
this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop');
|
||||
|
@ -26,7 +26,7 @@ var Indicator = new Lang.Class({
|
||||
_init() {
|
||||
this.parent('display-brightness-symbolic');
|
||||
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -34,7 +34,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
|
||||
this.menu.addMenuItem(this._item);
|
||||
@ -47,12 +47,12 @@ var Indicator = new Lang.Class({
|
||||
style_class: 'popup-menu-icon' });
|
||||
this._item.actor.add(icon);
|
||||
this._item.actor.add(this._slider.actor, { expand: true });
|
||||
this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
|
||||
this._item.actor.connect('button-press-event', (actor, event) => {
|
||||
return this._slider.startDragging(event);
|
||||
}));
|
||||
this._item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
|
||||
});
|
||||
this._item.actor.connect('key-press-event', (actor, event) => {
|
||||
return this._slider.onKeyPressEvent(actor, event);
|
||||
}));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
|
@ -209,7 +209,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
||||
'GetAll',
|
||||
new GLib.Variant('(s)', [this._BUS_IFACE]),
|
||||
null, Gio.DBusCallFlags.NONE, -1, null,
|
||||
Lang.bind(this, function(conn, result) {
|
||||
(conn, result) => {
|
||||
let props;
|
||||
try {
|
||||
props = conn.call_finish(result).deep_unpack()[0];
|
||||
@ -231,7 +231,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
||||
this._options = options;
|
||||
this._emitKeyboardOptionsChanged();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
get inputSources() {
|
||||
@ -485,7 +485,7 @@ var InputSourceManager = new Lang.Class({
|
||||
for (let i in this._inputSources)
|
||||
sourcesList.push(this._inputSources[i]);
|
||||
|
||||
this._keyboardManager.setUserLayouts(sourcesList.map(function(x) { return x.xkbId; }));
|
||||
this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
|
||||
|
||||
if (!this._disableIBus && this._mruSourcesBackup) {
|
||||
this._mruSources = this._mruSourcesBackup;
|
||||
@ -733,9 +733,7 @@ var InputSourceManager = new Lang.Class({
|
||||
Main.overview.disconnect(this._overviewHiddenId);
|
||||
this._overviewHiddenId = 0;
|
||||
|
||||
let windows = global.get_window_actors().map(function(w) {
|
||||
return w.meta_window;
|
||||
});
|
||||
let windows = global.get_window_actors().map(w => w.meta_window);
|
||||
for (let i = 0; i < windows.length; ++i) {
|
||||
delete windows[i]._inputSources;
|
||||
delete windows[i]._currentSource;
|
||||
@ -836,16 +834,14 @@ var InputSourceIndicator = new Lang.Class({
|
||||
let is = this._inputSourceManager.inputSources[i];
|
||||
|
||||
let menuItem = new LayoutMenuItem(is.displayName, is.shortName);
|
||||
menuItem.connect('activate', function() {
|
||||
is.activate(true);
|
||||
});
|
||||
menuItem.connect('activate', () => { is.activate(true); });
|
||||
|
||||
let indicatorLabel = new St.Label({ text: is.shortName,
|
||||
visible: false });
|
||||
|
||||
this._menuItems[i] = menuItem;
|
||||
this._indicatorLabels[i] = indicatorLabel;
|
||||
is.connect('changed', function() {
|
||||
is.connect('changed', () => {
|
||||
menuItem.indicator.set_text(is.shortName);
|
||||
indicatorLabel.set_text(is.shortName);
|
||||
});
|
||||
@ -939,7 +935,7 @@ var InputSourceIndicator = new Lang.Class({
|
||||
item.radioGroup = radioGroup;
|
||||
item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ?
|
||||
PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
if (item.prop.get_state() == IBus.PropState.CHECKED)
|
||||
return;
|
||||
|
||||
@ -957,13 +953,13 @@ var InputSourceIndicator = new Lang.Class({
|
||||
IBus.PropState.UNCHECKED);
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.TOGGLE:
|
||||
item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED);
|
||||
item.prop = prop;
|
||||
item.connect('toggled', Lang.bind(this, function() {
|
||||
item.connect('toggled', () => {
|
||||
if (item.state) {
|
||||
item.prop.set_state(IBus.PropState.CHECKED);
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
@ -973,16 +969,16 @@ var InputSourceIndicator = new Lang.Class({
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
IBus.PropState.UNCHECKED);
|
||||
}
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.NORMAL:
|
||||
item = new PopupMenu.PopupMenuItem(prop.get_label().get_text());
|
||||
item.prop = prop;
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
item.prop.get_state());
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.SEPARATOR:
|
||||
|
@ -116,11 +116,11 @@ var Indicator = new Lang.Class({
|
||||
this._permStoreProxy,
|
||||
this._getMaxAccuracyLevel());
|
||||
|
||||
authorizer.authorize(Lang.bind(this, function(accuracyLevel) {
|
||||
authorizer.authorize(accuracyLevel => {
|
||||
let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
|
||||
invocation.return_value(GLib.Variant.new('(bu)',
|
||||
[ret, accuracyLevel]));
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_syncIndicator() {
|
||||
@ -331,12 +331,11 @@ var AppAuthorizer = new Lang.Class({
|
||||
reason,
|
||||
this.reqAccuracyLevel);
|
||||
|
||||
let responseId = this._dialog.connect('response', Lang.bind(this,
|
||||
function(dialog, level) {
|
||||
this._dialog.disconnect(responseId);
|
||||
this._accuracyLevel = level;
|
||||
this._completeAuth();
|
||||
}));
|
||||
let responseId = this._dialog.connect('response', (dialog, level) => {
|
||||
this._dialog.disconnect(responseId);
|
||||
this._accuracyLevel = level;
|
||||
this._completeAuth();
|
||||
});
|
||||
|
||||
this._dialog.open();
|
||||
},
|
||||
@ -367,7 +366,7 @@ var AppAuthorizer = new Lang.Class({
|
||||
APP_PERMISSIONS_ID,
|
||||
this._permissions,
|
||||
data,
|
||||
function (result, error) {
|
||||
(result, error) => {
|
||||
if (error != null)
|
||||
log(error.message);
|
||||
});
|
||||
|
@ -293,12 +293,10 @@ var NMConnectionSection = new Lang.Class({
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item.connect('icon-changed', Lang.bind(this, function() {
|
||||
this._iconChanged();
|
||||
}));
|
||||
item.connect('activation-failed', Lang.bind(this, function(item, reason) {
|
||||
item.connect('icon-changed', () => { this._iconChanged(); });
|
||||
item.connect('activation-failed', (item, reason) => {
|
||||
this.emit('activation-failed', reason);
|
||||
}));
|
||||
});
|
||||
item.connect('name-changed', Lang.bind(this, this._sync));
|
||||
|
||||
let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction));
|
||||
@ -550,9 +548,9 @@ var NMDeviceModem = new Lang.Class({
|
||||
|
||||
if (this._mobileDevice) {
|
||||
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
|
||||
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
|
||||
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', () => {
|
||||
this._iconChanged();
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -649,13 +647,9 @@ var NMWirelessDialogItem = new Lang.Class({
|
||||
this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item',
|
||||
can_focus: true,
|
||||
reactive: true });
|
||||
this.actor.connect('key-focus-in', Lang.bind(this, function() {
|
||||
this.emit('selected');
|
||||
}));
|
||||
this.actor.connect('key-focus-in', () => { this.emit('selected'); });
|
||||
let action = new Clutter.ClickAction();
|
||||
action.connect('clicked', Lang.bind(this, function() {
|
||||
this.actor.grab_key_focus();
|
||||
}));
|
||||
action.connect('clicked', () => { this.actor.grab_key_focus(); });
|
||||
this.actor.add_action(action);
|
||||
|
||||
let title = ssidToLabel(this._ap.get_ssid());
|
||||
@ -725,9 +719,9 @@ var NMWirelessDialog = new Lang.Class({
|
||||
this._buildLayout();
|
||||
|
||||
let connections = client.get_connections();
|
||||
this._connections = connections.filter(Lang.bind(this, function(connection) {
|
||||
return device.connection_valid(connection);
|
||||
}));
|
||||
this._connections = connections.filter(
|
||||
connection => device.connection_valid(connection)
|
||||
);
|
||||
|
||||
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
|
||||
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
|
||||
@ -735,9 +729,9 @@ var NMWirelessDialog = new Lang.Class({
|
||||
|
||||
// accessPointAdded will also create dialog items
|
||||
let accessPoints = device.get_access_points() || [ ];
|
||||
accessPoints.forEach(Lang.bind(this, function(ap) {
|
||||
accessPoints.forEach(ap => {
|
||||
this._accessPointAdded(this._device, ap);
|
||||
}));
|
||||
});
|
||||
|
||||
this._selectedNetwork = null;
|
||||
this._activeApChanged();
|
||||
@ -902,12 +896,12 @@ var NMWirelessDialog = new Lang.Class({
|
||||
|
||||
let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout });
|
||||
this._airplaneButton = new St.Button({ style_class: 'modal-dialog-button button' });
|
||||
this._airplaneButton.connect('clicked', Lang.bind(this, function() {
|
||||
this._airplaneButton.connect('clicked', () => {
|
||||
if (this._rfkill.airplaneMode)
|
||||
this._rfkill.airplaneMode = false;
|
||||
else
|
||||
this._client.wireless_enabled = true;
|
||||
}));
|
||||
});
|
||||
airplaneSubStack.add_actor(this._airplaneButton);
|
||||
this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text',
|
||||
text: _("Use hardware switch to turn off") });
|
||||
@ -1058,7 +1052,7 @@ var NMWirelessDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_checkConnections(network, accessPoint) {
|
||||
this._connections.forEach(function(connection) {
|
||||
this._connections.forEach(connection => {
|
||||
if (accessPoint.connection_valid(connection) &&
|
||||
network.connections.indexOf(connection) == -1) {
|
||||
network.connections.push(connection);
|
||||
@ -1084,7 +1078,7 @@ var NMWirelessDialog = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
Util.insertSorted(network.accessPoints, accessPoint, function(one, two) {
|
||||
Util.insertSorted(network.accessPoints, accessPoint, (one, two) => {
|
||||
return two.strength - one.strength;
|
||||
});
|
||||
network.item.updateBestAP(network.accessPoints[0]);
|
||||
@ -1137,9 +1131,9 @@ var NMWirelessDialog = new Lang.Class({
|
||||
let scrollValue = adjustment.value;
|
||||
|
||||
this._itemBox.remove_all_children();
|
||||
this._networks.forEach(Lang.bind(this, function(network) {
|
||||
this._networks.forEach(network => {
|
||||
this._itemBox.add_child(network.item.actor);
|
||||
}));
|
||||
});
|
||||
|
||||
adjustment.value = scrollValue;
|
||||
},
|
||||
@ -1158,10 +1152,10 @@ var NMWirelessDialog = new Lang.Class({
|
||||
_createNetworkItem(network) {
|
||||
network.item = new NMWirelessDialogItem(network);
|
||||
network.item.setActive(network == this._selectedNetwork);
|
||||
network.item.connect('selected', Lang.bind(this, function() {
|
||||
network.item.connect('selected', () => {
|
||||
Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor);
|
||||
this._selectNetwork(network);
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@ -1518,12 +1512,12 @@ var NMVpnSection = new Lang.Class({
|
||||
for (let item of connections) {
|
||||
item.setActiveConnection(null);
|
||||
}
|
||||
vpnConnections.forEach(Lang.bind(this, function(a) {
|
||||
vpnConnections.forEach(a => {
|
||||
if (a.connection) {
|
||||
let item = this._connectionItems.get(a.connection.get_uuid());
|
||||
item.setActiveConnection(a);
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_makeConnectionItem(connection) {
|
||||
@ -1570,9 +1564,7 @@ var DeviceCategory = new Lang.Class({
|
||||
|
||||
_sync() {
|
||||
let nDevices = this.section.box.get_children().reduce(
|
||||
function(prev, child) {
|
||||
return prev + (child.visible ? 1 : 0);
|
||||
}, 0);
|
||||
(prev, child) => prev + (child.visible ? 1 : 0), 0);
|
||||
this._summaryItem.label.text = this._getSummaryLabel(nDevices);
|
||||
let shouldSummarize = nDevices > MAX_DEVICE_ITEMS;
|
||||
this._summaryItem.actor.visible = shouldSummarize;
|
||||
@ -1700,9 +1692,7 @@ var NMApplet = new Lang.Class({
|
||||
'network-transmit-receive');
|
||||
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
||||
|
||||
this._source.connect('destroy', Lang.bind(this, function() {
|
||||
this._source = null;
|
||||
}));
|
||||
this._source.connect('destroy', () => { this._source = null; });
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
},
|
||||
@ -1725,7 +1715,7 @@ var NMApplet = new Lang.Class({
|
||||
this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon });
|
||||
this._notification.setUrgency(urgency);
|
||||
this._notification.setTransient(true);
|
||||
this._notification.connect('destroy', function() {
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this._source.notify(this._notification);
|
||||
@ -1767,7 +1757,7 @@ var NMApplet = new Lang.Class({
|
||||
this._syncDeviceNames();
|
||||
|
||||
if (wrapper instanceof NMConnectionSection) {
|
||||
this._connections.forEach(function(connection) {
|
||||
this._connections.forEach(connection => {
|
||||
wrapper.checkConnection(connection);
|
||||
});
|
||||
}
|
||||
@ -1854,12 +1844,12 @@ var NMApplet = new Lang.Class({
|
||||
|
||||
_syncVpnConnections() {
|
||||
let activeConnections = this._client.get_active_connections() || [];
|
||||
let vpnConnections = activeConnections.filter(function(a) {
|
||||
return (a instanceof NM.VpnConnection);
|
||||
});
|
||||
vpnConnections.forEach(Lang.bind(this, function(a) {
|
||||
let vpnConnections = activeConnections.filter(
|
||||
a => (a instanceof NM.VpnConnection)
|
||||
);
|
||||
vpnConnections.forEach(a => {
|
||||
ensureActiveConnectionProps(a, this._client);
|
||||
}));
|
||||
});
|
||||
this._vpnSection.setActiveConnections(vpnConnections);
|
||||
|
||||
this._updateIcon();
|
||||
@ -1943,7 +1933,7 @@ var NMApplet = new Lang.Class({
|
||||
this._vpnSection.checkConnection(connection);
|
||||
} else {
|
||||
let devices = this._devices[section].devices;
|
||||
devices.forEach(function(wrapper) {
|
||||
devices.forEach(wrapper => {
|
||||
if (wrapper instanceof NMConnectionSection)
|
||||
wrapper.checkConnection(connection);
|
||||
});
|
||||
@ -1989,13 +1979,13 @@ var NMApplet = new Lang.Class({
|
||||
this._closeConnectivityCheck(path);
|
||||
return;
|
||||
} else if (result == PortalHelperResult.RECHECK) {
|
||||
this._client.check_connectivity_async(null, Lang.bind(this, function(client, result) {
|
||||
this._client.check_connectivity_async(null, (client, result) => {
|
||||
try {
|
||||
let state = client.check_connectivity_finish(result);
|
||||
if (state >= NM.ConnectivityState.FULL)
|
||||
this._closeConnectivityCheck(path);
|
||||
} catch(e) { }
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
log('Invalid result from portal helper: ' + result);
|
||||
}
|
||||
@ -2030,7 +2020,7 @@ var NMApplet = new Lang.Class({
|
||||
this._portalHelperProxy.AuthenticateRemote(path, '', timestamp);
|
||||
} else {
|
||||
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
|
||||
'/org/gnome/Shell/PortalHelper', Lang.bind(this, function (proxy, error) {
|
||||
'/org/gnome/Shell/PortalHelper', (proxy, error) => {
|
||||
if (error) {
|
||||
log('Error launching the portal helper: ' + error);
|
||||
return;
|
||||
@ -2040,7 +2030,7 @@ var NMApplet = new Lang.Class({
|
||||
proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone));
|
||||
|
||||
proxy.AuthenticateRemote(path, '', timestamp);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this._connectivityQueue.push(path);
|
||||
|
@ -47,7 +47,7 @@ var Indicator = new Lang.Class({
|
||||
this.indicators.add_style_class_name('power-status');
|
||||
|
||||
this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -55,7 +55,7 @@ var Indicator = new Lang.Class({
|
||||
this._proxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
|
||||
this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
|
||||
|
@ -26,7 +26,7 @@ var RfkillManager = new Lang.Class({
|
||||
|
||||
_init() {
|
||||
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -34,7 +34,7 @@ var RfkillManager = new Lang.Class({
|
||||
this._proxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._changed));
|
||||
this._changed();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
get airplaneMode() {
|
||||
@ -87,9 +87,9 @@ var Indicator = new Lang.Class({
|
||||
// changing the menu contents.
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
|
||||
this._item.icon.icon_name = 'airplane-mode-symbolic';
|
||||
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
|
||||
this._offItem = this._item.menu.addAction(_("Turn Off"), () => {
|
||||
this._manager.airplaneMode = false;
|
||||
}));
|
||||
});
|
||||
this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
|
||||
this.menu.addMenuItem(this._item);
|
||||
|
||||
|
@ -133,13 +133,12 @@ var Indicator = new Lang.Class({
|
||||
// settings (disable-log-out) and Polkit policy - the latter doesn't
|
||||
// notify, so we update the menu item each time the menu opens or
|
||||
// the lockdown setting changes, which should be close enough.
|
||||
this.menu.connect('open-state-changed', Lang.bind(this,
|
||||
function(menu, open) {
|
||||
if (!open)
|
||||
return;
|
||||
this.menu.connect('open-state-changed', (menu, open) => {
|
||||
if (!open)
|
||||
return;
|
||||
|
||||
this._systemActions.forceUpdate();
|
||||
}));
|
||||
this._systemActions.forceUpdate();
|
||||
});
|
||||
this._updateMultiUser();
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
@ -220,10 +219,10 @@ var Indicator = new Lang.Class({
|
||||
// the popup menu, and we can't easily connect on allocation-changed
|
||||
// or notify::width without creating layout cycles, simply update the
|
||||
// label whenever the menu is opened.
|
||||
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
|
||||
this.menu.connect('open-state-changed', (menu, isOpen) => {
|
||||
if (isOpen)
|
||||
this._updateSwitchUserSubMenu();
|
||||
}));
|
||||
});
|
||||
|
||||
item = new PopupMenu.PopupMenuItem(_("Switch User"));
|
||||
item.connect('activate', () => {
|
||||
|
@ -132,7 +132,7 @@ var Client = new Lang.Class({
|
||||
|
||||
enrollDevice(id, policy, callback) {
|
||||
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
|
||||
Lang.bind(this, function (res, error) {
|
||||
(res, error) => {
|
||||
if (error) {
|
||||
callback(null, error);
|
||||
return;
|
||||
@ -143,7 +143,7 @@ var Client = new Lang.Class({
|
||||
BOLT_DBUS_NAME,
|
||||
path);
|
||||
callback(device, null);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@ -271,9 +271,7 @@ var Indicator = new Lang.Class({
|
||||
if (!this._source) {
|
||||
this._source = new MessageTray.Source(_("Thunderbolt"),
|
||||
'thunderbolt-symbolic');
|
||||
this._source.connect('destroy', Lang.bind(this, function() {
|
||||
this._source = null;
|
||||
}));
|
||||
this._source.connect('destroy', () => { this._source = null; });
|
||||
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
@ -289,7 +287,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._notification = new MessageTray.Notification(source, title, body);
|
||||
this._notification.setUrgency(MessageTray.Urgency.HIGH);
|
||||
this._notification.connect('destroy', function() {
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this._notification.connect('activated', () => {
|
||||
|
@ -42,12 +42,12 @@ var StreamSlider = new Lang.Class({
|
||||
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
|
||||
this.item.actor.add(this._icon);
|
||||
this.item.actor.add(this._slider.actor, { expand: true });
|
||||
this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
|
||||
this.item.actor.connect('button-press-event', (actor, event) => {
|
||||
return this._slider.startDragging(event);
|
||||
}));
|
||||
this.item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
|
||||
});
|
||||
this.item.actor.connect('key-press-event', (actor, event) => {
|
||||
return this._slider.onKeyPressEvent(actor, event);
|
||||
}));
|
||||
});
|
||||
|
||||
this._stream = null;
|
||||
},
|
||||
@ -270,9 +270,9 @@ var VolumeMenu = new Lang.Class({
|
||||
this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
|
||||
|
||||
this._output = new OutputStreamSlider(this._control);
|
||||
this._output.connect('stream-updated', Lang.bind(this, function() {
|
||||
this._output.connect('stream-updated', () => {
|
||||
this.emit('icon-changed');
|
||||
}));
|
||||
});
|
||||
this.addMenuItem(this._output.item);
|
||||
|
||||
this._input = new InputStreamSlider(this._control);
|
||||
@ -324,7 +324,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._control = getMixerControl();
|
||||
this._volumeMenu = new VolumeMenu(this._control);
|
||||
this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) {
|
||||
this._volumeMenu.connect('icon-changed', menu => {
|
||||
let icon = this._volumeMenu.getIcon();
|
||||
|
||||
if (icon != null) {
|
||||
@ -333,7 +333,7 @@ var Indicator = new Lang.Class({
|
||||
} else {
|
||||
this.indicators.hide();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
this.menu.addMenuItem(this._volumeMenu);
|
||||
|
||||
|
Reference in New Issue
Block a user