Drop imports.lang usage

This commit is contained in:
Charles Gagnon
2022-04-04 13:25:45 -04:00
parent 5c9a29e7ed
commit dd70324840
11 changed files with 416 additions and 432 deletions

View File

@@ -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));
}
}

View File

@@ -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
);

View File

@@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const Lang = imports.lang;
const Clutter = imports.gi.Clutter;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;

View File

@@ -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();
});

View File

@@ -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,

View File

@@ -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());

View File

@@ -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);
})
}
);
}

534
prefs.js

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Layout = imports.ui.layout;

View File

@@ -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');
}
}

View File

@@ -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;