From 62be9d1fdd76ed9cc6f8214085e2d42c61225848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristijan=20Ribari=C4=87?= Date: Wed, 2 Oct 2024 14:44:48 +0200 Subject: [PATCH] Refactor: Remove unused workspace storage logic --- src/ZenWorkspaces.mjs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index df1caa9..f62efcd 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -51,11 +51,6 @@ var ZenWorkspaces = new class extends ZenMultiWindowFeature { } } - // Wrorkspaces saving/loading - get _storeFile() { - return PathUtils.join(PathUtils.profileDir, 'zen-workspaces', 'Workspaces.json'); - } - async _workspaces() { if (!this._workspaceCache) { this._workspaceCache = { workspaces: await ZenWorkspacesStorage.getWorkspaces() }; @@ -77,10 +72,7 @@ var ZenWorkspaces = new class extends ZenMultiWindowFeature { async initializeWorkspaces() { Services.prefs.addObserver('zen.workspaces.enabled', this.onWorkspacesEnabledChanged.bind(this)); - let file = new FileUtils.File(this._storeFile); - if (!file.exists()) { - await IOUtils.writeJSON(this._storeFile, {}); - } + await this.initializeWorkspacesButton(); if (this.workspaceEnabled) { this._initializeWorkspaceCreationIcons(); @@ -175,8 +167,9 @@ var ZenWorkspaces = new class extends ZenMultiWindowFeature { } async removeWorkspace(windowID) { + let workspacesData = await this._workspaces(); console.info('ZenWorkspaces: Removing workspace', windowID); - await this.changeWorkspace(json.workspaces.find((workspace) => workspace.uuid !== windowID)); + await this.changeWorkspace(workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID)); this._deleteAllTabsInWorkspace(windowID); delete this._lastSelectedWorkspaceTabs[windowID]; await ZenWorkspacesStorage.removeWorkspace(windowID);