Skip to content

Commit

Permalink
Move extension activation code from constructor to enable method
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard Minasyan committed May 24, 2021
1 parent 12faa42 commit 523f08f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
40 changes: 21 additions & 19 deletions sources/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,33 @@ class ActorScrollHandler {

class ExtensionModule {
constructor() {
/** @type WindowSwitcherPopup */
/** @type {_WindowSwitcherPopup.constructor} */
this.WindowSwitcherPopup = Me.imports.windowSwitcher.WindowSwitcherPopup;

/** @type {function()[]} */
this._signalDisconnectors = [];

/** @type {WindowSwitcherPopup} */
this._windowSwitcherPopup = null;

/** @type {WorkspaceSwitcherPopup.WorkspaceSwitcherPopup} */
this._workspacesSwitcherPopup = null;

/** @type {object} */
this._windowSwitchTimeoutHandle = null;

/** @type {object} */
this._workspaceSwitchTimeoutHandle = null;
}

enable() {
/** @type {_PrefsSource} */
this._prefsSource = new Me.imports.prefsSource.PrefsSource(Me);

/** @type {_PrefsCompanion} */
this.PrefsCompanion = new Me.imports.prefsCompanion.PrefsCompanion(
this._prefsCompanion = new Me.imports.prefsCompanion.PrefsCompanion(
this._prefsSource
);

/** @type {function()[]} */
this._signalDisconnectors = [];

this._workspacesSwitcherHandler = new ActorScrollHandler(
this._prefsSource,
this._prefsSource.workspacesSwitcher,
Expand All @@ -135,17 +148,6 @@ class ExtensionModule {
distance => this._switchWindow(distance)
);

/** @type {WindowSwitcherPopup} */
this._windowSwitcherPopup = null;

/** @type {WorkspaceSwitcherPopup.WorkspaceSwitcherPopup} */
this._workspacesSwitcherPopup = null;

this._windowSwitchTimeoutHandle = null;
this._workspaceSwitchTimeoutHandle = null;
}

enable() {
this._signalDisconnectors.push(
this._prefsSource.trackChanges(() => {
if (!this._prefsSource.pickingActorPathAction.value) {
Expand All @@ -159,7 +161,7 @@ class ExtensionModule {
);
}
}),
this.PrefsCompanion.run()
this._prefsCompanion.run()
);
}

Expand All @@ -179,7 +181,7 @@ class ExtensionModule {
this._prefsSource.switcherVerticalMultiplier(switcher).value;
handler.handleActor(
anyOfSwitcherMultipliersIsSet
? this.PrefsCompanion.findActor(
? this._prefsCompanion.findActor(
this._prefsSource.switcherActorPath(switcher).value
)
: null,
Expand Down
2 changes: 1 addition & 1 deletion sources/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"settings-schema": "io.github.mreditor.gnome-shell-extensions.scroll-panel",
"description": "This extension allows switching between windows or workspaces by scrolling Gnome Shell topbar with mouse (both in overview and workspace modes).",
"url": "https://github.com/mrEDitor/gnome-shell-extension-scroll-panel",
"semantic-version": "4.1.2"
"semantic-version": "4.1.3"
}
2 changes: 1 addition & 1 deletion sources/windowSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const AltTab = imports.ui.altTab;
* See original sources at {@link https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/js/ui/altTab.js}
*/
var WindowSwitcherPopup = GObject.registerClass(
class WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup {
class _WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup {
_init(windows) {
super._init();
this.reactive = false;
Expand Down

0 comments on commit 523f08f

Please sign in to comment.