diff --git a/appIcons.js b/appIcons.js index 48e3d30..e307d0d 100644 --- a/appIcons.js +++ b/appIcons.js @@ -28,7 +28,6 @@ const GLib = imports.gi.GLib; const Gtk = imports.gi.Gtk; const GObject = imports.gi.GObject; const Signals = imports.signals; -const Lang = imports.lang; const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; const St = imports.gi.St; @@ -201,10 +200,10 @@ var TaskbarAppIcon = GObject.registerClass({ this._showDots(); this._focusWindowChangedId = global.display.connect('notify::focus-window', - Lang.bind(this, this._onFocusAppChanged)); + this._onFocusAppChanged.bind(this)); this._windowEnteredMonitorId = this._windowLeftMonitorId = 0; - this._stateChangedId = this.app.connect('windows-changed', Lang.bind(this, this.onWindowsChanged)); + this._stateChangedId = this.app.connect('windows-changed', this.onWindowsChanged.bind(this)); if (!this.window) { if (Me.settings.get_boolean('isolate-monitors')) { @@ -216,50 +215,50 @@ var TaskbarAppIcon = GObject.registerClass({ this._minimizedWindowChangeId = 0; } else { this._titleWindowChangeId = this.window.connect('notify::title', - Lang.bind(this, this._updateWindowTitle)); + this._updateWindowTitle.bind(this)); this._minimizedWindowChangeId = this.window.connect('notify::minimized', - Lang.bind(this, this._updateWindowTitleStyle)); + this._updateWindowTitleStyle.bind(this)); } this._scrollEventId = this.actor.connect('scroll-event', this._onMouseScroll.bind(this)); this._overviewWindowDragEndId = Main.overview.connect('window-drag-end', - Lang.bind(this, this._onOverviewWindowDragEnd)); + this._onOverviewWindowDragEnd.bind(this)); this._switchWorkspaceId = global.window_manager.connect('switch-workspace', - Lang.bind(this, this._onSwitchWorkspace)); + this._onSwitchWorkspace.bind(this)); this._hoverChangeId = this.actor.connect('notify::hover', () => this._onAppIconHoverChanged()); this._dtpSettingsSignalIds = [ - Me.settings.connect('changed::animate-appicon-hover', Lang.bind(this, this._onAnimateAppiconHoverChanged)), - Me.settings.connect('changed::dot-position', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-size', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-style-focused', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-style-unfocused', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-dominant', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-override', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-1', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-2', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-3', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-4', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-unfocused-different', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-unfocused-1', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-unfocused-2', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-unfocused-3', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-color-unfocused-4', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::focus-highlight', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::focus-highlight-dominant', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::focus-highlight-color', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::focus-highlight-opacity', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::group-apps-label-font-size', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-label-font-weight', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-label-font-color', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-label-font-color-minimized', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-label-max-width', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-use-fixed-width', Lang.bind(this, this._updateWindowTitleStyle)), - Me.settings.connect('changed::group-apps-underline-unfocused', Lang.bind(this, this._settingsChangeRefresh)) + Me.settings.connect('changed::animate-appicon-hover', this._onAnimateAppiconHoverChanged.bind(this)), + Me.settings.connect('changed::dot-position', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-size', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-style-focused', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-style-unfocused', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-dominant', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-override', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-1', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-2', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-3', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-4', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-unfocused-different', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-unfocused-1', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-unfocused-2', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-unfocused-3', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::dot-color-unfocused-4', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::focus-highlight', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::focus-highlight-dominant', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::focus-highlight-color', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::focus-highlight-opacity', this._settingsChangeRefresh.bind(this)), + Me.settings.connect('changed::group-apps-label-font-size', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-label-font-weight', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-label-font-color', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-label-font-color-minimized', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-label-max-width', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-use-fixed-width', this._updateWindowTitleStyle.bind(this)), + Me.settings.connect('changed::group-apps-underline-unfocused', this._settingsChangeRefresh.bind(this)) ] this.forcedOverview = false; @@ -433,7 +432,7 @@ var TaskbarAppIcon = GObject.registerClass({ if (this._iconIconBinActorAddedId) { this.icon._iconBin.disconnect(this._iconIconBinActorAddedId); this._iconIconBinActorAddedId = 0; - this.icon.createIcon = Lang.bind(this, this._createIcon); + this.icon.createIcon = this._createIcon.bind(this); } } } @@ -483,7 +482,7 @@ var TaskbarAppIcon = GObject.registerClass({ this._focusedDots._tweeningToSize = null, this._unfocusedDots._tweeningToSize = null; - this._focusedDots.connect('repaint', Lang.bind(this, function() { + this._focusedDots.connect('repaint', () => { if(this._dashItemContainer.animatingOut) { // don't draw and trigger more animations if the icon is in the middle of // being added to the panel @@ -491,9 +490,9 @@ var TaskbarAppIcon = GObject.registerClass({ } this._drawRunningIndicator(this._focusedDots, Me.settings.get_string('dot-style-focused'), true); this._displayProperIndicator(); - })); + }); - this._unfocusedDots.connect('repaint', Lang.bind(this, function() { + this._unfocusedDots.connect('repaint', () => { if(this._dashItemContainer.animatingOut) { // don't draw and trigger more animations if the icon is in the middle of // being added to the panel @@ -501,7 +500,7 @@ var TaskbarAppIcon = GObject.registerClass({ } this._drawRunningIndicator(this._unfocusedDots, Me.settings.get_string('dot-style-unfocused'), false); this._displayProperIndicator(); - })); + }); this._dotsContainer.add_child(this._unfocusedDots); @@ -780,11 +779,11 @@ var TaskbarAppIcon = GObject.registerClass({ let tweenOpts = { time: Taskbar.DASH_ANIMATION_TIME, transition: 'easeInOutCubic', - onComplete: Lang.bind(this, function() { + onComplete: () => { if(newOtherOpacity > 0) otherDots.opacity = newOtherOpacity; dots._tweeningToSize = null; - }) + } }; if(newOtherOpacity == 0) @@ -1619,15 +1618,13 @@ function ItemShowLabel() { this._onKeyboardPopupMenu = AppDisplay.AppIcon.prototype._onKeyboardPopupMenu; // No action on clicked (showing of the appsview is controlled elsewhere) - this._onClicked = Lang.bind(this, function(actor, button) { - this._removeMenuTimeout(); - }); + this._onClicked = (actor, button) => this._removeMenuTimeout(); - this.actor.connect('leave-event', Lang.bind(this, this._onLeaveEvent)); - this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); - this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent)); - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); - this.actor.connect('popup-menu', Lang.bind(this, this._onKeyboardPopupMenu)); + this.actor.connect('leave-event', this._onLeaveEvent.bind(this)); + this.actor.connect('button-press-event', this._onButtonPress.bind(this)); + this.actor.connect('touch-event', this._onTouchEvent.bind(this)); + this.actor.connect('clicked', this._onClicked.bind(this)); + this.actor.connect('popup-menu', this._onKeyboardPopupMenu.bind(this)); this._menu = null; this._menuManager = new PopupMenu.PopupMenuManager(this.actor); @@ -1854,7 +1851,7 @@ var MyShowAppsIconMenu = class extends PopupMenu.PopupMenu { if(this.sourceActor == Main.layoutManager.dummyCursor) { this._appendSeparator(); let item = this._appendMenuItem(this._dtpPanel._restoreWindowList ? _('Restore Windows') : _('Show Desktop')); - item.connect('activate', Lang.bind(this._dtpPanel, this._dtpPanel._onShowDesktopButtonPress)); + item.connect('activate', this._dtpPanel._onShowDesktopButtonPress.bind(this._dtpPanel)); } } diff --git a/extension.js b/extension.js index 9a8c8ac..018d56c 100644 --- a/extension.js +++ b/extension.js @@ -22,7 +22,6 @@ const Main = imports.ui.main; const Meta = imports.gi.Meta; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; -const Lang = imports.lang; const Shell = imports.gi.Shell; const St = imports.gi.St; const WindowManager = imports.ui.windowManager; @@ -109,12 +108,12 @@ function _enable() { Utils.addKeybinding( 'open-application-menu', new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - Lang.bind(this, function() { + () => { if(Me.settings.get_boolean('show-appmenu')) Main.wm._toggleAppMenu(); else panelManager.primaryPanel.taskbar.popupFocusedAppSecondaryMenu(); - }), + }, Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP ); } @@ -131,7 +130,7 @@ function disable(reset) { Utils.addKeybinding( 'open-application-menu', new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), - Lang.bind(Main.wm, Main.wm._toggleAppMenu), + Main.wm._toggleAppMenu.bind(Main.wm), Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP ); diff --git a/intellihide.js b/intellihide.js index 9cdf764..7a09afc 100644 --- a/intellihide.js +++ b/intellihide.js @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -const Lang = imports.lang; const Clutter = imports.gi.Clutter; const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; diff --git a/overview.js b/overview.js index ff13643..6effdfc 100644 --- a/overview.js +++ b/overview.js @@ -26,7 +26,6 @@ const Utils = Me.imports.utils; const Clutter = imports.gi.Clutter; const Config = imports.misc.config; -const Lang = imports.lang; const Main = imports.ui.main; const Shell = imports.gi.Shell; const Gtk = imports.gi.Gtk; @@ -119,23 +118,7 @@ var Overview = class { _optionalWorkspaceIsolation() { let label = 'optionalWorkspaceIsolation'; - this._signalsHandler.add([ - Me.settings, - 'changed::isolate-workspaces', - Lang.bind(this, function() { - this._panel.panelManager.allPanels.forEach(p => p.taskbar.resetAppIcons()); - - if (Me.settings.get_boolean('isolate-workspaces')) - Lang.bind(this, enable)(); - else - Lang.bind(this, disable)(); - }) - ]); - - if (Me.settings.get_boolean('isolate-workspaces')) - Lang.bind(this, enable)(); - - function enable() { + let enable = () => { this._injectionsHandler.removeWithLabel(label); this._injectionsHandler.addWithLabel(label, [ @@ -153,7 +136,7 @@ var Overview = class { ]); } - function disable() { + let disable = () => { this._signalsHandler.removeWithLabel(label); this._injectionsHandler.removeWithLabel(label); } @@ -170,6 +153,22 @@ var Overview = class { return this.open_new_window(-1); } + + this._signalsHandler.add([ + Me.settings, + 'changed::isolate-workspaces', + () => { + this._panel.panelManager.allPanels.forEach(p => p.taskbar.resetAppIcons()); + + if (Me.settings.get_boolean('isolate-workspaces')) + enable(); + else + disable(); + } + ]); + + if (Me.settings.get_boolean('isolate-workspaces')) + enable(); } // Hotkeys @@ -251,12 +250,12 @@ var Overview = class { this._signalsHandler.add([ Me.settings, 'changed::hot-keys', - Lang.bind(this, function() { - if (Me.settings.get_boolean('hot-keys')) - Lang.bind(this, this._enableHotKeys)(); - else - Lang.bind(this, this._disableHotKeys)(); - }) + () => { + if (Me.settings.get_boolean('hot-keys')) + this._enableHotKeys(); + else + this._disableHotKeys(); + } ]); } @@ -336,16 +335,16 @@ var Overview = class { this._signalsHandler.add([ Me.settings, 'changed::hot-keys', - Lang.bind(this, this._checkHotkeysOptions) + this._checkHotkeysOptions.bind(this) ], [ Me.settings, 'changed::hotkeys-overlay-combo', - Lang.bind(this, function() { + () => { if (Me.settings.get_boolean('hot-keys') && Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS') this.taskbar.toggleNumberOverlay(true); else this.taskbar.toggleNumberOverlay(false); - }) + } ], [ Me.settings, 'changed::shortcut-num-keys', @@ -397,7 +396,7 @@ var Overview = class { } // Hide the overlay/dock after the timeout - this._numberOverlayTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, function() { + this._numberOverlayTimeoutId = Mainloop.timeout_add(timeout, () => { this._numberOverlayTimeoutId = 0; if (hotkey_option != 'ALWAYS') { @@ -405,7 +404,7 @@ var Overview = class { } this._panel.intellihide.release(Intellihide.Hold.TEMPORARY); - })); + }); } _optionalClickToExit() { @@ -416,12 +415,12 @@ var Overview = class { this._signalsHandler.add([ Me.settings, 'changed::overview-click-to-exit', - Lang.bind(this, function() { - if (Me.settings.get_boolean('overview-click-to-exit')) - Lang.bind(this, this._enableClickToExit)(); - else - Lang.bind(this, this._disableClickToExit)(); - }) + () => { + if (Me.settings.get_boolean('overview-click-to-exit')) + this._enableClickToExit(); + else + this._disableClickToExit(); + } ]); } @@ -429,7 +428,6 @@ var Overview = class { if (this._clickToExitEnabled) return; - let view = imports.ui.appDisplay; this._oldOverviewReactive = Main.overview._overview.reactive Main.overview._overview.reactive = true; @@ -441,7 +439,6 @@ var Overview = class { return Clutter.EVENT_PROPAGATE; let [x, y] = global.get_pointer(); - let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y); Main.overview.toggle(); }); diff --git a/panel.js b/panel.js index 1f50108..de49941 100644 --- a/panel.js +++ b/panel.js @@ -39,7 +39,6 @@ const { Taskbar, TaskbarItemContainer } = Me.imports.taskbar; const Pos = Me.imports.panelPositions; const PanelSettings = Me.imports.panelSettings; const { PanelStyle } = Me.imports.panelStyle; -const Lang = imports.lang; const Main = imports.ui.main; const Mainloop = imports.mainloop; const Dash = imports.ui.dash; @@ -302,7 +301,7 @@ var Panel = GObject.registerClass({ // sync hover after a popupmenu is closed this.taskbar, 'menu-closed', - Lang.bind(this, function(){this.panel.actor.sync_hover();}) + () => this.panel.actor.sync_hover() ], [ Main.overview, diff --git a/panelManager.js b/panelManager.js index 9d63e91..6432821 100755 --- a/panelManager.js +++ b/panelManager.js @@ -36,7 +36,6 @@ const Taskbar = Me.imports.taskbar; const Utils = Me.imports.utils; const Config = imports.misc.config; -const Lang = imports.lang; const Gi = imports._gi; const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; @@ -145,7 +144,7 @@ var PanelManager = class { Main.layoutManager._updatePanelBarrier(); this._oldUpdateHotCorners = Main.layoutManager._updateHotCorners; - Main.layoutManager._updateHotCorners = Lang.bind(Main.layoutManager, newUpdateHotCorners); + Main.layoutManager._updateHotCorners = newUpdateHotCorners.bind(Main.layoutManager); Main.layoutManager._updateHotCorners(); this._forceHotCornerId = Me.settings.connect('changed::stockgs-force-hotcorner', () => Main.layoutManager._updateHotCorners()); diff --git a/panelStyle.js b/panelStyle.js index bc78c01..626e493 100644 --- a/panelStyle.js +++ b/panelStyle.js @@ -23,7 +23,6 @@ const Me = imports.misc.extensionUtils.getCurrentExtension(); const ExtensionUtils = imports.misc.extensionUtils; -const Lang = imports.lang; const Main = imports.ui.main; const Mainloop = imports.mainloop; const St = imports.gi.St; @@ -63,10 +62,10 @@ var PanelStyle = class { this._dtpSettingsSignalIds = []; for(let i in configKeys) { - this._dtpSettingsSignalIds.push(Me.settings.connect('changed::' + configKeys[i], Lang.bind(this, function () { + this._dtpSettingsSignalIds.push(Me.settings.connect('changed::' + configKeys[i], () => { this._removeStyles(); this._applyStyles(); - }))); + })); } } @@ -99,10 +98,10 @@ var PanelStyle = class { }; } - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, trayPaddingStyleLine, operationIdx); this._refreshPanelButton(actor); - }); + }; this._rightBoxOperations.push(operation); } @@ -113,9 +112,9 @@ var PanelStyle = class { operation.compareFn = function (actor) { return (actor.has_style_class_name && actor.has_style_class_name('system-status-icon')); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, statusIconPaddingStyleLine, operationIdx); - }); + }; this._rightBoxOperations.push(operation); } @@ -126,9 +125,9 @@ var PanelStyle = class { operation.compareFn = function (actor) { return (actor.constructor && actor.constructor.name == 'St_Icon'); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, trayIconSizeStyleLine, operationIdx); - }); + }; this._rightBoxOperations.push(operation); let trayContentSizeStyleLine = 'font-size: %dpx'.format(trayContentSize) @@ -136,9 +135,9 @@ var PanelStyle = class { operation.compareFn = function (actor) { return (actor.constructor && actor.constructor.name == 'St_Label'); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, trayContentSizeStyleLine, operationIdx); - }); + }; this._rightBoxOperations.push(operation); this._overrideStyle(this.panel._rightBox, trayContentSizeStyleLine, 0); @@ -158,9 +157,9 @@ var PanelStyle = class { let parent = actor.get_parent(); return (parent && parent.has_style_class_name && parent.has_style_class_name('panel-button')); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, leftboxPaddingStyleLine, operationIdx); - }); + }; this._leftBoxOperations.push(operation); } @@ -171,9 +170,9 @@ var PanelStyle = class { operation.compareFn = function (actor) { return (actor.constructor && actor.constructor.name == 'St_Icon'); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, leftboxIconSizeStyleLine, operationIdx); - }); + }; this._leftBoxOperations.push(operation); let leftboxContentSizeStyleLine = 'font-size: %dpx'.format(leftboxContentSize) @@ -181,9 +180,9 @@ var PanelStyle = class { operation.compareFn = function (actor) { return (actor.constructor && actor.constructor.name == 'St_Label'); }; - operation.applyFn = Lang.bind(this, function (actor, operationIdx) { + operation.applyFn = (actor, operationIdx) => { this._overrideStyle(actor, leftboxContentSizeStyleLine, operationIdx); - }); + }; this._leftBoxOperations.push(operation); this._overrideStyle(this.panel._leftBox, leftboxContentSizeStyleLine, 0); @@ -193,26 +192,26 @@ var PanelStyle = class { /* connect signal */ this._rightBoxActorAddedID = this.panel._rightBox.connect('actor-added', - Lang.bind(this, function (container, actor) { + (container, actor) => { if(this._rightBoxOperations.length && !this._ignoreAddedChild) this._recursiveApply(actor, this._rightBoxOperations); this._ignoreAddedChild = 0; - }) + } ); this._centerBoxActorAddedID = this.panel._centerBox.connect('actor-added', - Lang.bind(this, function (container, actor) { + (container, actor) => { if(this._centerBoxOperations.length && !this._ignoreAddedChild) this._recursiveApply(actor, this._centerBoxOperations); this._ignoreAddedChild = 0; - }) + } ); this._leftBoxActorAddedID = this.panel._leftBox.connect('actor-added', - Lang.bind(this, function (container, actor) { + (container, actor) => { if(this._leftBoxOperations.length) this._recursiveApply(actor, this._leftBoxOperations); - }) + } ); } diff --git a/prefs.js b/prefs.js index 6cf0edd..77dd166 100644 --- a/prefs.js +++ b/prefs.js @@ -26,7 +26,6 @@ const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; const Gdk = imports.gi.Gdk; -const Lang = imports.lang; const Mainloop = imports.mainloop; const Config = imports.misc.config; @@ -157,10 +156,9 @@ function mergeObjects(main, bck) { return main; }; -const Preferences = new Lang.Class({ - Name: 'DashToPanel.Preferences', +const Preferences = class { - _init: function() { + constructor() { this._settings = Convenience.getSettings('org.gnome.shell.extensions.dash-to-panel'); this._rtl = (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL); this._builder = new Gtk.Builder(); @@ -182,16 +180,16 @@ const Preferences = new Lang.Class({ this._leftbox_padding_timeout = 0; this._addFormatValueCallbacks(); this._bindSettings(); - }, + } /** * Connect signals */ - _connector: function(builder, object, signal, handler) { - object.connect(signal, Lang.bind(this, this._SignalHandler[handler])); - }, + _connector(builder, object, signal, handler) { + object.connect(signal, this._SignalHandler[handler].bind(this)); + } - _updateVerticalRelatedOptions: function() { + _updateVerticalRelatedOptions() { let position = this._getPanelPosition(this._currentMonitorIndex); let isVertical = position == Pos.LEFT || position == Pos.RIGHT; let showDesktopWidthLabel = this._builder.get_object('show_showdesktop_width_label'); @@ -199,9 +197,9 @@ const Preferences = new Lang.Class({ showDesktopWidthLabel.set_text(isVertical ? _('Show Desktop button height (px)') : _('Show Desktop button width (px)')); this._displayPanelPositionsForMonitor(this._currentMonitorIndex); - }, + } - _maybeDisableTopPosition: function() { + _maybeDisableTopPosition() { let keepTopPanel = this._settings.get_boolean('stockgs-keep-top-panel'); let monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); let topAvailable = !keepTopPanel || (!monitorSync && this._currentMonitorIndex != this.monitors[0]); @@ -209,22 +207,22 @@ const Preferences = new Lang.Class({ topRadio.set_sensitive(topAvailable); topRadio.set_tooltip_text(!topAvailable ? _('Unavailable when gnome-shell top panel is present') : ''); - }, + } - _getPanelPosition: function(monitorIndex) { + _getPanelPosition(monitorIndex) { return PanelSettings.getPanelPosition(this._settings, monitorIndex); - }, + } - _setPanelPosition: function(position) { + _setPanelPosition(position) { const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; monitorsToSetFor.forEach(monitorIndex => { PanelSettings.setPanelPosition(this._settings, monitorIndex, position); }); this._setAnchorLabels(this._currentMonitorIndex); - }, + } - _setPositionRadios: function(position) { + _setPositionRadios(position) { this._ignorePositionRadios = true; switch (position) { @@ -243,14 +241,14 @@ const Preferences = new Lang.Class({ } this._ignorePositionRadios = false; - }, + } /** * Set panel anchor combo labels according to whether the monitor's panel is vertical * or horizontal, or if all monitors' panels are being configured and they are a mix * of vertical and horizontal. */ - _setAnchorLabels: function(currentMonitorIndex) { + _setAnchorLabels(currentMonitorIndex) { const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); const monitorsToSetFor = monitorSync ? this.monitors : [currentMonitorIndex]; const allVertical = monitorsToSetFor.every(i => { @@ -290,13 +288,13 @@ const Preferences = new Lang.Class({ const panel_anchor = PanelSettings.getPanelAnchor(this._settings, currentMonitorIndex); this._builder.get_object('panel_anchor_combo').set_active_id(panel_anchor); } - }, + } /** * When a monitor is selected, update the widgets for panel position, size, anchoring, * and contents so they accurately show the settings for the panel on that monitor. */ - _updateWidgetSettingsForMonitor: function(monitorIndex) { + _updateWidgetSettingsForMonitor(monitorIndex) { // Update display of panel screen position setting this._maybeDisableTopPosition(); const panelPosition = this._getPanelPosition(monitorIndex); @@ -316,19 +314,19 @@ const Preferences = new Lang.Class({ // Update display of panel content settings this._displayPanelPositionsForMonitor(monitorIndex); - }, + } /** * Anchor is only relevant if panel length is less than 100%. Enable or disable * anchor widget sensitivity accordingly. */ - _setAnchorWidgetSensitivity: function(panelLength) { + _setAnchorWidgetSensitivity(panelLength) { const isPartialLength = panelLength < 100; this._builder.get_object('panel_anchor_label').set_sensitive(isPartialLength); this._builder.get_object('panel_anchor_combo').set_sensitive(isPartialLength); - }, + } - _displayPanelPositionsForMonitor: function(monitorIndex) { + _displayPanelPositionsForMonitor(monitorIndex) { let taskbarListBox = this._builder.get_object('taskbar_display_listbox'); while(taskbarListBox.get_first_child()) @@ -433,9 +431,9 @@ const Preferences = new Lang.Class({ row.set_child(grid); taskbarListBox.insert(row, -1); }); - }, + } - _showShowAppsButtonOptions: function() { + _showShowAppsButtonOptions() { let dialog = new Gtk.Dialog({ title: _('Show Applications options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -474,14 +472,14 @@ const Preferences = new Lang.Class({ this._settings.set_string('show-apps-icon-file', newIconPath || ''); }; - fileChooserButton.connect('clicked', Lang.bind(this, function() { + fileChooserButton.connect('clicked', () => { fileChooser.show(); - })); + }); fileChooser.connect('response', widget => handleIconChange.call(this, widget.get_file().get_path())); handleIconChange.call(this, this._settings.get_string('show-apps-icon-file')); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('show-apps-icon-side-padding', this._settings.get_default_value('show-apps-icon-side-padding')); @@ -495,13 +493,13 @@ const Preferences = new Lang.Class({ fileChooser.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(1, 1); - }, + } - _showDesktopButtonOptions: function() { + _showDesktopButtonOptions() { let dialog = new Gtk.Dialog({ title: _('Show Desktop options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -515,21 +513,21 @@ const Preferences = new Lang.Class({ dialog.get_content_area().append(box); this._builder.get_object('show_showdesktop_width_spinbutton').set_value(this._settings.get_int('showdesktop-button-width')); - this._builder.get_object('show_showdesktop_width_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('show_showdesktop_width_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('showdesktop-button-width', widget.get_value()); - })); + }); this._builder.get_object('show_showdesktop_delay_spinbutton').set_value(this._settings.get_int('show-showdesktop-delay')); - this._builder.get_object('show_showdesktop_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('show_showdesktop_delay_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('show-showdesktop-delay', widget.get_value()); - })); + }); this._builder.get_object('show_showdesktop_time_spinbutton').set_value(this._settings.get_int('show-showdesktop-time')); - this._builder.get_object('show_showdesktop_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('show_showdesktop_time_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('show-showdesktop-time', widget.get_value()); - })); + }); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('showdesktop-button-width', this._settings.get_default_value('showdesktop-button-width')); @@ -548,90 +546,90 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(1, 1); - }, + } - _addFormatValueCallbacks: function() { + _addFormatValueCallbacks() { // position this._builder.get_object('panel_size_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); // style this._builder.get_object('appicon_margin_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); this._builder.get_object('appicon_padding_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); // fine-tune box1 this._builder.get_object('tray_size_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); this._builder.get_object('leftbox_size_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); // fine-tune box2 this._builder.get_object('tray_padding_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); this._builder.get_object('statusicon_padding_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); this._builder.get_object('leftbox_padding_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return value + ' px'; - })); + }); // animate hovering app icons dialog this._builder.get_object('animate_appicon_hover_options_duration_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return _("%d ms").format(value); - })); + }); this._builder.get_object('animate_appicon_hover_options_rotation_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return _("%d °").format(value); - })); + }); this._builder.get_object('animate_appicon_hover_options_travel_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return _("%d %%").format(value); - })); + }); this._builder.get_object('animate_appicon_hover_options_zoom_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return _("%d %%").format(value); - })); + }); this._builder.get_object('animate_appicon_hover_options_convexity_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return _("%.1f").format(value); - })); + }); this._builder.get_object('animate_appicon_hover_options_extent_scale') - .set_format_value_func(Lang.bind(this, function(scale, value) { + .set_format_value_func((scale, value) => { return Gettext.ngettext("%d icon", "%d icons", value).format(value); - })); - }, + }); + } - _bindSettings: function() { + _bindSettings() { // size options let panel_size_scale = this._builder.get_object('panel_size_scale'); panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length - 1], DEFAULT_PANEL_SIZES[0]); @@ -669,58 +667,58 @@ const Preferences = new Lang.Class({ } this._builder.get_object('dot_style_focused_combo').set_active_id(this._settings.get_string('dot-style-focused')); - this._builder.get_object('dot_style_focused_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('dot_style_focused_combo').connect('changed', (widget) => { this._settings.set_string('dot-style-focused', widget.get_active_id()); - })); + }); this._builder.get_object('dot_style_unfocused_combo').set_active_id(this._settings.get_string('dot-style-unfocused')); - this._builder.get_object('dot_style_unfocused_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('dot_style_unfocused_combo').connect('changed', (widget) => { this._settings.set_string('dot-style-unfocused', widget.get_active_id()); - })); + }); for (let i = 1; i <= MAX_WINDOW_INDICATOR; i++) { let idx = i; - this._builder.get_object('dot_color_' + idx + '_colorbutton').connect('color-set', Lang.bind(this, function(button) { + this._builder.get_object('dot_color_' + idx + '_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('dot-color-' + idx, hexString); - })); + }); - this._builder.get_object('dot_color_unfocused_' + idx + '_colorbutton').connect('color-set', Lang.bind(this, function(button) { + this._builder.get_object('dot_color_unfocused_' + idx + '_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('dot-color-unfocused-' + idx, hexString); - })); + }); } - this._builder.get_object('dot_color_apply_all_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('dot_color_apply_all_button').connect('clicked', () => { for (let i = 2; i <= MAX_WINDOW_INDICATOR; i++) { this._settings.set_value('dot-color-' + i, this._settings.get_value('dot-color-1')); let rgba = new Gdk.RGBA(); rgba.parse(this._settings.get_string('dot-color-' + i)); this._builder.get_object('dot_color_' + i + '_colorbutton').set_rgba(rgba); } - })); + }); - this._builder.get_object('dot_color_unfocused_apply_all_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('dot_color_unfocused_apply_all_button').connect('clicked', () => { for (let i = 2; i <= MAX_WINDOW_INDICATOR; i++) { this._settings.set_value('dot-color-unfocused-' + i, this._settings.get_value('dot-color-unfocused-1')); let rgba = new Gdk.RGBA(); rgba.parse(this._settings.get_string('dot-color-unfocused-' + i)); this._builder.get_object('dot_color_unfocused_' + i + '_colorbutton').set_rgba(rgba); } - })); + }); - this._builder.get_object('focus_highlight_color_colorbutton').connect('color-set', Lang.bind(this, function(button) { + this._builder.get_object('focus_highlight_color_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('focus-highlight-color', hexString); - })); + }); - this._builder.get_object('dot_style_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('dot_style_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Running Indicator Options'), transient_for: this.notebook.get_root(), @@ -745,12 +743,12 @@ const Preferences = new Lang.Class({ Gio.SettingsBindFlags.DEFAULT); // when either becomes active, turn the other off - this._builder.get_object('dot_color_dominant_switch').connect('state-set', Lang.bind (this, function(widget) { + this._builder.get_object('dot_color_dominant_switch').connect('state-set', (widget) => { if (widget.get_active()) this._settings.set_boolean('dot-color-override', false); - })); - this._builder.get_object('dot_color_override_switch').connect('state-set', Lang.bind (this, function(widget) { + }); + this._builder.get_object('dot_color_override_switch').connect('state-set', (widget) => { if (widget.get_active()) this._settings.set_boolean('dot-color-dominant', false); - })); + }); this._settings.bind('dot-color-unfocused-different', this._builder.get_object('dot_color_unfocused_different_switch'), @@ -815,16 +813,16 @@ const Preferences = new Lang.Class({ }).apply(this); this._builder.get_object('focus_highlight_opacity_spinbutton').set_value(this._settings.get_int('focus-highlight-opacity')); - this._builder.get_object('focus_highlight_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('focus_highlight_opacity_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('focus-highlight-opacity', widget.get_value()); - })); + }); this._builder.get_object('dot_size_spinbutton').set_value(this._settings.get_int('dot-size')); - this._builder.get_object('dot_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('dot_size_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('dot-size', widget.get_value()); - })); + }); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('dot-color-dominant', this._settings.get_default_value('dot-color-dominant')); @@ -863,12 +861,12 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(1, 1); - })); + }); //multi-monitor this.monitors = this._settings.get_value('available-monitors').deep_unpack(); @@ -911,14 +909,14 @@ const Preferences = new Lang.Class({ this._setAnchorLabels(this._currentMonitorIndex); }); - this._builder.get_object('multimon_primary_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('multimon_primary_combo').connect('changed', (widget) => { this._settings.set_int('primary-monitor', this.monitors[widget.get_active()]); - })); + }); - this._builder.get_object('taskbar_position_monitor_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('taskbar_position_monitor_combo').connect('changed', (widget) => { this._currentMonitorIndex = this.monitors[widget.get_active()]; this._updateWidgetSettingsForMonitor(this._currentMonitorIndex); - })); + }); this._settings.bind('multi-monitors', this._builder.get_object('multimon_multi_switch'), @@ -930,7 +928,7 @@ const Preferences = new Lang.Class({ } const panel_length_scale = this._builder.get_object('panel_length_scale'); - panel_length_scale.connect('value-changed', Lang.bind (this, function(widget) { + panel_length_scale.connect('value-changed', (widget) => { const value = widget.get_value(); const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; @@ -939,9 +937,9 @@ const Preferences = new Lang.Class({ }); this._setAnchorWidgetSensitivity(value); - })); + }); - this._builder.get_object('panel_anchor_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('panel_anchor_combo').connect('changed', (widget) => { const value = widget.get_active_id(); // Value can be null while anchor labels are being swapped out if (value !== null) { @@ -951,7 +949,7 @@ const Preferences = new Lang.Class({ PanelSettings.setPanelAnchor(this._settings, monitorIndex, value); }); } - })); + }); this._updateWidgetSettingsForMonitor(this._currentMonitorIndex); @@ -970,12 +968,12 @@ const Preferences = new Lang.Class({ rgba.parse(this._settings.get_string('trans-bg-color')); this._builder.get_object('trans_bg_color_colorbutton').set_rgba(rgba); - this._builder.get_object('trans_bg_color_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('trans_bg_color_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('trans-bg-color', hexString); - })); + }); this._settings.bind('trans-use-custom-opacity', this._builder.get_object('trans_opacity_override_switch'), @@ -993,9 +991,9 @@ const Preferences = new Lang.Class({ }); this._builder.get_object('trans_opacity_spinbutton').set_value(this._settings.get_double('trans-panel-opacity') * 100); - this._builder.get_object('trans_opacity_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_opacity_spinbutton').connect('value-changed', (widget) => { this._settings.set_double('trans-panel-opacity', widget.get_value() * 0.01); - })); + }); this._settings.bind('trans-use-dynamic-opacity', this._builder.get_object('trans_dyn_switch'), @@ -1025,49 +1023,49 @@ const Preferences = new Lang.Class({ rgba.parse(this._settings.get_string('trans-gradient-top-color')); this._builder.get_object('trans_gradient_color1_colorbutton').set_rgba(rgba); - this._builder.get_object('trans_gradient_color1_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('trans_gradient_color1_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('trans-gradient-top-color', hexString); - })); + }); this._builder.get_object('trans_gradient_color1_spinbutton').set_value(this._settings.get_double('trans-gradient-top-opacity') * 100); - this._builder.get_object('trans_gradient_color1_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_gradient_color1_spinbutton').connect('value-changed', (widget) => { this._settings.set_double('trans-gradient-top-opacity', widget.get_value() * 0.01); - })); + }); rgba.parse(this._settings.get_string('trans-gradient-bottom-color')); this._builder.get_object('trans_gradient_color2_colorbutton').set_rgba(rgba); - this._builder.get_object('trans_gradient_color2_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('trans_gradient_color2_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('trans-gradient-bottom-color', hexString); - })); + }); this._builder.get_object('trans_gradient_color2_spinbutton').set_value(this._settings.get_double('trans-gradient-bottom-opacity') * 100); - this._builder.get_object('trans_gradient_color2_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_gradient_color2_spinbutton').connect('value-changed', (widget) => { this._settings.set_double('trans-gradient-bottom-opacity', widget.get_value() * 0.01); - })); + }); this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance')); - this._builder.get_object('trans_options_distance_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_options_distance_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('trans-dynamic-distance', widget.get_value()); - })); + }); this._builder.get_object('trans_options_min_opacity_spinbutton').set_value(this._settings.get_double('trans-dynamic-anim-target') * 100); - this._builder.get_object('trans_options_min_opacity_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_options_min_opacity_spinbutton').connect('value-changed', (widget) => { this._settings.set_double('trans-dynamic-anim-target', widget.get_value() * 0.01); - })); + }); this._builder.get_object('trans_options_anim_time_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-time')); - this._builder.get_object('trans_options_anim_time_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('trans_options_anim_time_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('trans-dynamic-anim-time', widget.get_value()); - })); + }); - this._builder.get_object('trans_dyn_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('trans_dyn_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Dynamic opacity options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -1080,7 +1078,7 @@ const Preferences = new Lang.Class({ let box = this._builder.get_object('box_dynamic_opacity_options'); dialog.get_content_area().append(box); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('trans-dynamic-behavior', this._settings.get_default_value('trans-dynamic-behavior')); @@ -1099,12 +1097,12 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(1, 1); - })); + }); this._settings.bind('desktop-line-use-custom-color', this._builder.get_object('override_show_desktop_line_color_switch'), @@ -1118,11 +1116,11 @@ const Preferences = new Lang.Class({ rgba.parse(this._settings.get_string('desktop-line-custom-color')); this._builder.get_object('override_show_desktop_line_color_colorbutton').set_rgba(rgba); - this._builder.get_object('override_show_desktop_line_color_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('override_show_desktop_line_color_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); this._settings.set_string('desktop-line-custom-color', css); - })); + }); this._settings.bind('intellihide', @@ -1181,14 +1179,14 @@ const Preferences = new Lang.Class({ }); this._builder.get_object('intellihide_pressure_threshold_spinbutton').set_value(this._settings.get_int('intellihide-pressure-threshold')); - this._builder.get_object('intellihide_pressure_threshold_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('intellihide_pressure_threshold_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('intellihide-pressure-threshold', widget.get_value()); - })); + }); this._builder.get_object('intellihide_pressure_time_spinbutton').set_value(this._settings.get_int('intellihide-pressure-time')); - this._builder.get_object('intellihide_pressure_time_spinbutton').connect('value-changed', Lang.bind(this, function (widget) { + this._builder.get_object('intellihide_pressure_time_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('intellihide-pressure-time', widget.get_value()); - })); + }); this._settings.bind('intellihide-key-toggle-text', this._builder.get_object('intellihide_toggle_entry'), @@ -1197,21 +1195,21 @@ const Preferences = new Lang.Class({ this._settings.connect('changed::intellihide-key-toggle-text', () => setShortcut(this._settings, 'intellihide-key-toggle')); this._builder.get_object('intellihide_animation_time_spinbutton').set_value(this._settings.get_int('intellihide-animation-time')); - this._builder.get_object('intellihide_animation_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('intellihide_animation_time_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('intellihide-animation-time', widget.get_value()); - })); + }); this._builder.get_object('intellihide_close_delay_spinbutton').set_value(this._settings.get_int('intellihide-close-delay')); - this._builder.get_object('intellihide_close_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('intellihide_close_delay_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('intellihide-close-delay', widget.get_value()); - })); + }); this._builder.get_object('intellihide_enable_start_delay_spinbutton').set_value(this._settings.get_int('intellihide-enable-start-delay')); - this._builder.get_object('intellihide_enable_start_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('intellihide_enable_start_delay_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('intellihide-enable-start-delay', widget.get_value()); - })); + }); - this._builder.get_object('intellihide_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('intellihide_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Intellihide options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -1224,7 +1222,7 @@ const Preferences = new Lang.Class({ let box = this._builder.get_object('box_intellihide_options'); dialog.get_content_area().append(box); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('intellihide-hide-from-windows', this._settings.get_default_value('intellihide-hide-from-windows')); @@ -1255,19 +1253,19 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(1, 1); - })); + }); // Behavior panel this._builder.get_object('show_applications_side_padding_spinbutton').set_value(this._settings.get_int('show-apps-icon-side-padding')); - this._builder.get_object('show_applications_side_padding_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('show_applications_side_padding_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('show-apps-icon-side-padding', widget.get_value()); - })); + }); this._settings.bind('show-apps-override-escape', this._builder.get_object('show_applications_esc_key_switch'), @@ -1326,14 +1324,14 @@ const Preferences = new Lang.Class({ this._setPreviewTitlePosition(); - this._builder.get_object('grid_preview_title_font_color_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('grid_preview_title_font_color_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('window-preview-title-font-color', hexString); - })); + }); - this._builder.get_object('show_window_previews_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('show_window_previews_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Window preview options'), transient_for: this.notebook.get_root(), @@ -1349,9 +1347,9 @@ const Preferences = new Lang.Class({ dialog.get_content_area().append(scrolledWindow); this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout')); - this._builder.get_object('preview_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_timeout_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('show-window-previews-timeout', widget.get_value()); - })); + }); this._settings.bind('preview-middle-click-close', this._builder.get_object('preview_middle_click_close_switch'), @@ -1386,9 +1384,9 @@ const Preferences = new Lang.Class({ Gio.SettingsBindFlags.DEFAULT); this._builder.get_object('preview_custom_opacity_spinbutton').set_value(this._settings.get_int('preview-custom-opacity')); - this._builder.get_object('preview_custom_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_custom_opacity_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('preview-custom-opacity', widget.get_value()); - })); + }); this._settings.bind('peek-mode', this._builder.get_object('peek_mode_switch'), @@ -1425,14 +1423,14 @@ const Preferences = new Lang.Class({ Gio.SettingsBindFlags.DEFAULT); this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout')); - this._builder.get_object('enter_peek_mode_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('enter_peek_mode_timeout_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('enter-peek-mode-timeout', widget.get_value()); - })); + }); this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout')); - this._builder.get_object('leave_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('leave_timeout_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('leave-timeout', widget.get_value()); - })); + }); this._settings.bind('window-preview-hide-immediate-click', this._builder.get_object('preview_immediate_click_button'), @@ -1440,49 +1438,49 @@ const Preferences = new Lang.Class({ Gio.SettingsBindFlags.DEFAULT); this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time')); - this._builder.get_object('animation_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('animation_time_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('window-preview-animation-time', widget.get_value()); - })); + }); this._builder.get_object('peek_mode_opacity_spinbutton').set_value(this._settings.get_int('peek-mode-opacity')); - this._builder.get_object('peek_mode_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('peek_mode_opacity_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('peek-mode-opacity', widget.get_value()); - })); + }); this._builder.get_object('preview_size_spinbutton').set_value(this._settings.get_int('window-preview-size')); - this._builder.get_object('preview_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_size_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('window-preview-size', widget.get_value()); - })); + }); this._builder.get_object('preview_aspect_ratio_x_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-x').toString()); - this._builder.get_object('preview_aspect_ratio_x_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_aspect_ratio_x_combo').connect('changed', (widget) => { this._settings.set_int('window-preview-aspect-ratio-x', parseInt(widget.get_active_id(), 10)); - })); + }); this._builder.get_object('preview_aspect_ratio_y_combo').set_active_id(this._settings.get_int('window-preview-aspect-ratio-y').toString()); - this._builder.get_object('preview_aspect_ratio_y_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_aspect_ratio_y_combo').connect('changed', (widget) => { this._settings.set_int('window-preview-aspect-ratio-y', parseInt(widget.get_active_id(), 10)); - })); + }); this._builder.get_object('preview_padding_spinbutton').set_value(this._settings.get_int('window-preview-padding')); - this._builder.get_object('preview_padding_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_padding_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('window-preview-padding', widget.get_value()); - })); + }); this._builder.get_object('preview_title_size_spinbutton').set_value(this._settings.get_int('window-preview-title-font-size')); - this._builder.get_object('preview_title_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_title_size_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('window-preview-title-font-size', widget.get_value()); - })); + }); this._builder.get_object('preview_custom_icon_size_spinbutton').set_value(this._settings.get_int('window-preview-custom-icon-size')); - this._builder.get_object('preview_custom_icon_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('preview_custom_icon_size_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('window-preview-custom-icon-size', widget.get_value()); - })); + }); this._builder.get_object('grid_preview_title_weight_combo').set_active_id(this._settings.get_string('window-preview-title-font-weight')); - this._builder.get_object('grid_preview_title_weight_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('grid_preview_title_weight_combo').connect('changed', (widget) => { this._settings.set_string('window-preview-title-font-weight', widget.get_active_id()); - })); + }); (function() { let rgba = new Gdk.RGBA(); @@ -1490,7 +1488,7 @@ const Preferences = new Lang.Class({ this._builder.get_object('grid_preview_title_font_color_colorbutton').set_rgba(rgba); }).apply(this); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('show-window-previews-timeout', this._settings.get_default_value('show-window-previews-timeout')); @@ -1558,11 +1556,11 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); - })); + }); this._settings.bind('isolate-workspaces', this._builder.get_object('isolate_workspaces_switch'), @@ -1594,19 +1592,19 @@ const Preferences = new Lang.Class({ 'sensitive', Gio.SettingsBindFlags.DEFAULT | Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._builder.get_object('group_apps_label_font_color_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('group_apps_label_font_color_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('group-apps-label-font-color', hexString); - })); + }); - this._builder.get_object('group_apps_label_font_color_minimized_colorbutton').connect('color-set', Lang.bind(this, function (button) { + this._builder.get_object('group_apps_label_font_color_minimized_colorbutton').connect('color-set', (button) => { let rgba = button.get_rgba(); let css = rgba.to_string(); let hexString = cssHexString(css); this._settings.set_string('group-apps-label-font-color-minimized', hexString); - })); + }); this._settings.bind('group-apps-use-fixed-width', this._builder.get_object('group_apps_use_fixed_width_switch'), @@ -1623,7 +1621,7 @@ const Preferences = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); - this._builder.get_object('show_group_apps_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('show_group_apps_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Ungrouped application options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -1637,14 +1635,14 @@ const Preferences = new Lang.Class({ dialog.get_content_area().append(box); this._builder.get_object('group_apps_label_font_size_spinbutton').set_value(this._settings.get_int('group-apps-label-font-size')); - this._builder.get_object('group_apps_label_font_size_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('group_apps_label_font_size_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('group-apps-label-font-size', widget.get_value()); - })); + }); this._builder.get_object('group_apps_label_font_weight_combo').set_active_id(this._settings.get_string('group-apps-label-font-weight')); - this._builder.get_object('group_apps_label_font_weight_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('group_apps_label_font_weight_combo').connect('changed', (widget) => { this._settings.set_string('group-apps-label-font-weight', widget.get_active_id()); - })); + }); (function() { let rgba = new Gdk.RGBA(); @@ -1659,11 +1657,11 @@ const Preferences = new Lang.Class({ }).apply(this); this._builder.get_object('group_apps_label_max_width_spinbutton').set_value(this._settings.get_int('group-apps-label-max-width')); - this._builder.get_object('group_apps_label_max_width_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('group_apps_label_max_width_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('group-apps-label-max-width', widget.get_value()); - })); + }); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('group-apps-label-font-size', this._settings.get_default_value('group-apps-label-font-size')); @@ -1694,31 +1692,31 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(600, 1); - })); + }); this._builder.get_object('click_action_combo').set_active_id(this._settings.get_string('click-action')); - this._builder.get_object('click_action_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('click_action_combo').connect('changed', (widget) => { this._settings.set_string('click-action', widget.get_active_id()); - })); + }); - this._builder.get_object('shift_click_action_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('shift_click_action_combo').connect('changed', (widget) => { this._settings.set_string('shift-click-action', widget.get_active_id()); - })); + }); - this._builder.get_object('middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('middle_click_action_combo').connect('changed', (widget) => { this._settings.set_string('middle-click-action', widget.get_active_id()); - })); - this._builder.get_object('shift_middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) { + }); + this._builder.get_object('shift_middle_click_action_combo').connect('changed', (widget) => { this._settings.set_string('shift-middle-click-action', widget.get_active_id()); - })); + }); // Create dialog for middle-click options - this._builder.get_object('middle_click_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('middle_click_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Customize middle-click behavior'), transient_for: this.notebook.get_root(), @@ -1751,7 +1749,7 @@ const Preferences = new Lang.Class({ 'active-id', Gio.SettingsBindFlags.DEFAULT); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings for the relevant keys let keys = ['shift-click-action', 'middle-click-action', 'shift-middle-click-action']; @@ -1767,25 +1765,25 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(700, 1); - })); + }); this._builder.get_object('scroll_panel_combo').set_active_id(this._settings.get_string('scroll-panel-action')); - this._builder.get_object('scroll_panel_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('scroll_panel_combo').connect('changed', (widget) => { this._settings.set_string('scroll-panel-action', widget.get_active_id()); - })); + }); this._builder.get_object('scroll_icon_combo').set_active_id(this._settings.get_string('scroll-icon-action')); - this._builder.get_object('scroll_icon_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('scroll_icon_combo').connect('changed', (widget) => { this._settings.set_string('scroll-icon-action', widget.get_active_id()); - })); + }); // Create dialog for panel scroll options - this._builder.get_object('scroll_panel_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('scroll_panel_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Customize panel scroll behavior'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -1799,16 +1797,16 @@ const Preferences = new Lang.Class({ dialog.get_content_area().append(box); this._builder.get_object('scroll_panel_options_delay_spinbutton').set_value(this._settings.get_int('scroll-panel-delay')); - this._builder.get_object('scroll_panel_options_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('scroll_panel_options_delay_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('scroll-panel-delay', widget.get_value()); - })); + }); this._settings.bind('scroll-panel-show-ws-popup', this._builder.get_object('scroll_panel_options_show_ws_popup_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('scroll-panel-delay', this._settings.get_default_value('scroll-panel-delay')); @@ -1821,15 +1819,15 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(640, 1); - })); + }); // Create dialog for icon scroll options - this._builder.get_object('scroll_icon_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('scroll_icon_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Customize icon scroll behavior'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -1843,11 +1841,11 @@ const Preferences = new Lang.Class({ dialog.get_content_area().append(box); this._builder.get_object('scroll_icon_options_delay_spinbutton').set_value(this._settings.get_int('scroll-icon-delay')); - this._builder.get_object('scroll_icon_options_delay_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._builder.get_object('scroll_icon_options_delay_spinbutton').connect('value-changed', (widget) => { this._settings.set_int('scroll-icon-delay', widget.get_value()); - })); + }); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('scroll-icon-delay', this._settings.get_default_value('scroll-icon-delay')); @@ -1858,12 +1856,12 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(640, 1); - })); + }); this._settings.bind('hot-keys', this._builder.get_object('hot_keys_switch'), @@ -1874,9 +1872,9 @@ const Preferences = new Lang.Class({ 'sensitive', Gio.SettingsBindFlags.DEFAULT); - this._builder.get_object('overlay_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('overlay_combo').connect('changed', (widget) => { this._settings.set_string('hotkeys-overlay-combo', widget.get_active_id()); - })); + }); this._settings.bind('shortcut-previews', this._builder.get_object('shortcut_preview_switch'), @@ -1884,11 +1882,11 @@ const Preferences = new Lang.Class({ Gio.SettingsBindFlags.DEFAULT); this._builder.get_object('shortcut_num_keys_combo').set_active_id(this._settings.get_string('shortcut-num-keys')); - this._builder.get_object('shortcut_num_keys_combo').connect('changed', Lang.bind (this, function(widget) { + this._builder.get_object('shortcut_num_keys_combo').connect('changed', (widget) => { this._settings.set_string('shortcut-num-keys', widget.get_active_id()); - })); + }); - this._settings.connect('changed::hotkey-prefix-text', Lang.bind(this, function() {checkHotkeyPrefix(this._settings);})); + this._settings.connect('changed::hotkey-prefix-text', () => {checkHotkeyPrefix(this._settings);}); this._builder.get_object('hotkey_prefix_combo').set_active_id(this._settings.get_string('hotkey-prefix-text')); @@ -1912,21 +1910,21 @@ const Preferences = new Lang.Class({ this._builder.get_object('timeout_spinbutton').set_sensitive(false); } - this._settings.connect('changed::hotkeys-overlay-combo', Lang.bind(this, function() { + this._settings.connect('changed::hotkeys-overlay-combo', () => { if (this._settings.get_string('hotkeys-overlay-combo') !== 'TEMPORARILY') this._builder.get_object('timeout_spinbutton').set_sensitive(false); else this._builder.get_object('timeout_spinbutton').set_sensitive(true); - })); + }); this._settings.bind('shortcut-text', this._builder.get_object('shortcut_entry'), 'text', Gio.SettingsBindFlags.DEFAULT); - this._settings.connect('changed::shortcut-text', Lang.bind(this, function() {setShortcut(this._settings, 'shortcut');})); + this._settings.connect('changed::shortcut-text', () => {setShortcut(this._settings, 'shortcut');}); // Create dialog for number overlay options - this._builder.get_object('overlay_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('overlay_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Advanced hotkeys options'), transient_for: this.notebook.get_root(), @@ -1940,7 +1938,7 @@ const Preferences = new Lang.Class({ let box = this._builder.get_object('box_overlay_shortcut'); dialog.get_content_area().append(box); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings for the relevant keys let keys = ['hotkey-prefix-text', 'shortcut-text', 'hotkeys-overlay-combo', 'overlay-timeout', 'shortcut-previews']; @@ -1953,15 +1951,15 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(600, 1); - })); + }); // setup dialog for secondary menu options - this._builder.get_object('secondarymenu_options_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('secondarymenu_options_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Secondary Menu Options'), transient_for: this.notebook.get_root(), @@ -1985,7 +1983,7 @@ const Preferences = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('secondarymenu-contains-appmenu', this._settings.get_default_value('secondarymenu-contains-appmenu')); @@ -1996,15 +1994,15 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(480, 1); - })); + }); // setup dialog for advanced options - this._builder.get_object('button_advanced_options').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('button_advanced_options').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('Advanced Options'), transient_for: this.notebook.get_root(), @@ -2018,7 +2016,7 @@ const Preferences = new Lang.Class({ let box = this._builder.get_object('box_advanced_options'); dialog.get_content_area().append(box); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings @@ -2028,12 +2026,12 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); dialog.set_default_size(480, 1); - })); + }); // Fine-tune panel @@ -2141,7 +2139,7 @@ const Preferences = new Lang.Class({ scales.forEach(updateScale); } - this._builder.get_object('animate_appicon_hover_button').connect('clicked', Lang.bind(this, function() { + this._builder.get_object('animate_appicon_hover_button').connect('clicked', () => { let dialog = new Gtk.Dialog({ title: _('App icon animation options'), transient_for: this.notebook.get_root(), use_header_bar: true, @@ -2154,7 +2152,7 @@ const Preferences = new Lang.Class({ let box = this._builder.get_object('animate_appicon_hover_options'); dialog.get_content_area().append(box); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { if (id == 1) { // restore default settings this._settings.set_value('animate-appicon-hover-animation-type', this._settings.get_default_value('animate-appicon-hover-animation-type')); @@ -2170,11 +2168,11 @@ const Preferences = new Lang.Class({ dialog.destroy(); } return; - })); + }); dialog.show(); - })); + }); this._settings.bind('stockgs-keep-dash', this._builder.get_object('stockgs_dash_switch'), @@ -2249,9 +2247,9 @@ const Preferences = new Lang.Class({ ); }); - }, + } - _setPreviewTitlePosition: function() { + _setPreviewTitlePosition() { switch (this._settings.get_string('window-preview-title-position')) { case 'BOTTOM': this._builder.get_object('preview_title_position_bottom_button').set_active(true); @@ -2260,9 +2258,9 @@ const Preferences = new Lang.Class({ this._builder.get_object('preview_title_position_top_button').set_active(true); break; } - }, + } - _showFileChooser: function(title, params, acceptBtn, acceptHandler) { + _showFileChooser(title, params, acceptBtn, acceptHandler) { let dialog = new Gtk.FileChooserDialog(mergeObjects({ title: title, transient_for: this.notebook.get_root() }, params)); dialog.add_button("Cancel", Gtk.ResponseType.CANCEL); @@ -2270,12 +2268,12 @@ const Preferences = new Lang.Class({ dialog.show(); - dialog.connect('response', Lang.bind(this, function(dialog, id) { + dialog.connect('response', (dialog, id) => { acceptHandler.call(this, dialog.get_file().get_path()); dialog.destroy(); - })); + }); } -}); +} const BuilderScope = GObject.registerClass({ @@ -2352,7 +2350,7 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._panel_size_timeout > 0) Mainloop.source_remove(this._preferences._panel_size_timeout); - this._preferences._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this._preferences, function() { + this._preferences._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, (() => { const value = scale.get_value(); const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; @@ -2362,7 +2360,7 @@ const BuilderScope = GObject.registerClass({ this._panel_size_timeout = 0; return GLib.SOURCE_REMOVE; - })); + })).bind(this._preferences); } tray_size_scale_value_changed_cb(scale) { @@ -2370,11 +2368,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._tray_size_timeout > 0) Mainloop.source_remove(this._preferences._tray_size_timeout); - this._preferences._tray_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._tray_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('tray-size', scale.get_value()); this._preferences._tray_size_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } leftbox_size_scale_value_changed_cb(scale) { @@ -2382,11 +2380,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._leftbox_size_timeout > 0) Mainloop.source_remove(this._preferences._leftbox_size_timeout); - this._preferences._leftbox_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._leftbox_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('leftbox-size', scale.get_value()); this._preferences._leftbox_size_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } appicon_margin_scale_value_changed_cb(scale) { @@ -2394,11 +2392,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._appicon_margin_timeout > 0) Mainloop.source_remove(this._preferences._appicon_margin_timeout); - this._preferences._appicon_margin_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._appicon_margin_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('appicon-margin', scale.get_value()); this._preferences._appicon_margin_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } appicon_padding_scale_value_changed_cb(scale) { @@ -2406,11 +2404,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._appicon_padding_timeout > 0) Mainloop.source_remove(this._preferences._appicon_padding_timeout); - this._preferences._appicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._appicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('appicon-padding', scale.get_value()); this._preferences._appicon_padding_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } tray_padding_scale_value_changed_cb(scale) { @@ -2418,11 +2416,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._tray_padding_timeout > 0) Mainloop.source_remove(this._preferences._tray_padding_timeout); - this._preferences._tray_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._tray_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('tray-padding', scale.get_value()); this._preferences._tray_padding_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } statusicon_padding_scale_value_changed_cb(scale) { @@ -2430,11 +2428,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._statusicon_padding_timeout > 0) Mainloop.source_remove(this._preferences._statusicon_padding_timeout); - this._preferences._statusicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._statusicon_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('status-icon-padding', scale.get_value()); this._preferences._statusicon_padding_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } leftbox_padding_scale_value_changed_cb(scale) { @@ -2442,11 +2440,11 @@ const BuilderScope = GObject.registerClass({ if (this._preferences._leftbox_padding_timeout > 0) Mainloop.source_remove(this._preferences._leftbox_padding_timeout); - this._preferences._leftbox_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { + this._preferences._leftbox_padding_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int('leftbox-padding', scale.get_value()); this._preferences._leftbox_padding_timeout = 0; return GLib.SOURCE_REMOVE; - })); + }); } }); diff --git a/proximity.js b/proximity.js index ee41380..d568809 100644 --- a/proximity.js +++ b/proximity.js @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -const Lang = imports.lang; const Meta = imports.gi.Meta; const Layout = imports.ui.layout; diff --git a/taskbar.js b/taskbar.js index 886099e..a18576d 100644 --- a/taskbar.js +++ b/taskbar.js @@ -29,7 +29,6 @@ const GLib = imports.gi.GLib; const GObject = imports.gi.GObject; const Gtk = imports.gi.Gtk; const Signals = imports.signals; -const Lang = imports.lang; const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; const St = imports.gi.St; @@ -227,15 +226,15 @@ var Taskbar = class { vscrollbar_policy: Gtk.PolicyType.NEVER, enable_mouse_scrolling: true }); - this._scrollView.connect('leave-event', Lang.bind(this, this._onLeaveEvent)); - this._scrollView.connect('motion-event', Lang.bind(this, this._onMotionEvent)); - this._scrollView.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); + this._scrollView.connect('leave-event', this._onLeaveEvent.bind(this)); + this._scrollView.connect('motion-event', this._onMotionEvent.bind(this)); + this._scrollView.connect('scroll-event', this._onScrollEvent.bind(this)); this._scrollView.add_actor(this._box); this._showAppsIconWrapper = panel.showAppsIconWrapper; - this._showAppsIconWrapper.connect('menu-state-changed', Lang.bind(this, function(showAppsIconWrapper, opened) { + this._showAppsIconWrapper.connect('menu-state-changed', (showAppsIconWrapper, opened) => { this._itemMenuStateChanged(showAppsIconWrapper, opened); - })); + }); // an instance of the showAppsIcon class is encapsulated in the wrapper this._showAppsIcon = this._showAppsIconWrapper.realShowAppsIcon; this.showAppsButton = this._showAppsIcon.toggleButton; @@ -244,7 +243,7 @@ var Taskbar = class { this.showAppsButton.set_width(panel.geom.w); } - this.showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled)); + this.showAppsButton.connect('notify::checked', this._onShowAppsButtonToggled.bind(this)); this.showAppsButton.checked = (SearchController._showAppsButton) ? SearchController._showAppsButton.checked : false; @@ -280,7 +279,7 @@ var Taskbar = class { let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment; - this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); + this._workId = Main.initializeDeferredWork(this._box, this._redisplay.bind(this)); this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); @@ -302,20 +301,20 @@ var Taskbar = class { [ this._appSystem, 'installed-changed', - Lang.bind(this, function() { + () => { AppFavorites.getAppFavorites().reload(); this._queueRedisplay(); - }) + } ], [ this._appSystem, 'app-state-changed', - Lang.bind(this, this._queueRedisplay) + this._queueRedisplay.bind(this) ], [ AppFavorites.getAppFavorites(), 'changed', - Lang.bind(this, this._queueRedisplay) + this._queueRedisplay.bind(this) ], [ global.window_manager, @@ -337,23 +336,23 @@ var Taskbar = class { [ Main.overview, 'item-drag-begin', - Lang.bind(this, this._onDragBegin) + this._onDragBegin.bind(this) ], [ Main.overview, 'item-drag-end', - Lang.bind(this, this._onDragEnd) + this._onDragEnd.bind(this) ], [ Main.overview, 'item-drag-cancelled', - Lang.bind(this, this._onDragCancelled) + this._onDragCancelled.bind(this) ], [ // Ensure the ShowAppsButton status is kept in sync SearchController._showAppsButton, 'notify::checked', - Lang.bind(this, this._syncShowAppsButtonToggled) + this._syncShowAppsButtonToggled.bind(this) ], [ Me.settings, @@ -363,15 +362,15 @@ var Taskbar = class { 'changed::show-running-apps', 'changed::show-favorites-all-monitors' ], - Lang.bind(this, this._redisplay) + this._redisplay.bind(this) ], [ Me.settings, 'changed::group-apps', - Lang.bind(this, function() { + () => { this.isGroupApps = Me.settings.get_boolean('group-apps'); this._connectWorkspaceSignals(); - }) + } ], [ Me.settings, @@ -548,7 +547,7 @@ var Taskbar = class { _onDragBegin() { this._dragCancelled = false; this._dragMonitor = { - dragMotion: Lang.bind(this, this._onDragMotion) + dragMotion: this._onDragMotion.bind(this) }; DND.addDragMonitor(this._dragMonitor); @@ -647,13 +646,13 @@ var Taskbar = class { } _hookUpLabel(item, syncHandler) { - item.child.connect('notify::hover', Lang.bind(this, function() { + item.child.connect('notify::hover', () => { this._syncLabel(item, syncHandler); - })); + }); - syncHandler.connect('sync-tooltip', Lang.bind(this, function() { + syncHandler.connect('sync-tooltip', () => { this._syncLabel(item, syncHandler); - })); + }); } _createAppItem(app, window, isLauncher) { @@ -675,23 +674,23 @@ var Taskbar = class { if (appIcon._draggable) { appIcon._draggable.connect('drag-begin', - Lang.bind(this, function() { + () => { appIcon.actor.opacity = 0; appIcon.isDragged = 1; this._dropIconAnimations(); - })); + }); appIcon._draggable.connect('drag-end', - Lang.bind(this, function() { + () => { appIcon.actor.opacity = 255; delete appIcon.isDragged; this._updateAppIcons(); - })); + }); } appIcon.connect('menu-state-changed', - Lang.bind(this, function(appIcon, opened) { + (appIcon, opened) => { this._itemMenuStateChanged(item, opened); - })); + }); let item = new TaskbarItemContainer(); @@ -701,13 +700,13 @@ var Taskbar = class { item.setChild(appIcon.actor); appIcon._dashItemContainer = item; - appIcon.actor.connect('notify::hover', Lang.bind(this, function() { + appIcon.actor.connect('notify::hover', () => { if (appIcon.actor.hover){ - this._ensureAppIconVisibilityTimeoutId = Mainloop.timeout_add(100, Lang.bind(this, function(){ + this._ensureAppIconVisibilityTimeoutId = Mainloop.timeout_add(100, () => { Utils.ensureActorVisibleInScrollView(this._scrollView, appIcon.actor, this._scrollView._dtpFadeSize); this._ensureAppIconVisibilityTimeoutId = 0; return GLib.SOURCE_REMOVE; - })); + }); if (!appIcon.isDragged && iconAnimationSettings.type == 'SIMPLE') appIcon.actor.get_parent().raise(1); @@ -722,14 +721,14 @@ var Taskbar = class { if (!appIcon.isDragged && iconAnimationSettings.type == 'SIMPLE') appIcon.actor.get_parent().raise(0); } - })); + }); appIcon.actor.connect('clicked', - Lang.bind(this, function(actor) { + (actor) => { Utils.ensureActorVisibleInScrollView(this._scrollView, actor, this._scrollView._dtpFadeSize); - })); + }); - appIcon.actor.connect('key-focus-in', Lang.bind(this, function(actor) { + appIcon.actor.connect('key-focus-in', (actor) => { let [x_shift, y_shift] = Utils.ensureActorVisibleInScrollView(this._scrollView, actor, this._scrollView._dtpFadeSize); // This signal is triggered also by mouse click. The popup menu is opened at the original @@ -738,7 +737,7 @@ var Taskbar = class { appIcon._menu._boxPointer.xOffset = -x_shift; appIcon._menu._boxPointer.yOffset = -y_shift; } - })); + }); // Override default AppIcon label_actor, now the // accessible_name is set at DashItemContainer.setLabelText @@ -811,12 +810,12 @@ var Taskbar = class { if (this._showLabelTimeoutId == 0) { let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; this._showLabelTimeoutId = Mainloop.timeout_add(timeout, - Lang.bind(this, function() { + () => { this._labelShowing = true; item.showLabel(); this._showLabelTimeoutId = 0; return GLib.SOURCE_REMOVE; - })); + }); GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel'); if (this._resetHoverTimeoutId > 0) { Mainloop.source_remove(this._resetHoverTimeoutId); @@ -830,11 +829,11 @@ var Taskbar = class { item.hideLabel(); if (this._labelShowing) { this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT, - Lang.bind(this, function() { + () => { this._labelShowing = false; this._resetHoverTimeoutId = 0; return GLib.SOURCE_REMOVE; - })); + }); GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing'); } } diff --git a/transparency.js b/transparency.js index 10fac2c..fe32e0d 100644 --- a/transparency.js +++ b/transparency.js @@ -17,7 +17,6 @@ const Clutter = imports.gi.Clutter; const GdkPixbuf = imports.gi.GdkPixbuf; -const Lang = imports.lang; const Main = imports.ui.main; const Meta = imports.gi.Meta; const St = imports.gi.St;