From 3db007a3eabd3a1685dbf8d3fcba6437f226ac78 Mon Sep 17 00:00:00 2001 From: baku Date: Sat, 21 Jan 2017 22:11:35 +0100 Subject: [PATCH] Issue #102 - Remove/Create/Update propagation in the '+' menu (no color/name in the awesomebar yet) --- index.js | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 6dd87d4..af9a3dd 100644 --- a/index.js +++ b/index.js @@ -98,9 +98,7 @@ const ContainerService = { // Modify CSS and other stuff for each window. - for (let window of windows.browserWindows) { // eslint-disable-line prefer-const - this.configureWindow(viewFor(window)); - } + this.configureWindows(); windows.browserWindows.on("open", window => { this.configureWindow(viewFor(window)); @@ -441,6 +439,8 @@ const ContainerService = { openTabs: 0 }; + this._refreshNeeded(); + return Promise.resolve(this._convert(identity)); }, @@ -457,11 +457,14 @@ const ContainerService = { } // FIXME: icon and color conversion based on FF version. - // FIXME: color/name update propagation - return Promise.resolve(ContextualIdentityService.update(args.userContextId, - identity.name, - identity.icon, - identity.color)); + + const updated = ContextualIdentityService.update(args.userContextId, + identity.name, + identity.icon, + identity.color); + + this._refreshNeeded(); + return Promise.resolve(updated); }, removeIdentity(args) { @@ -473,11 +476,20 @@ const ContainerService = { tab.close(); }); - return Promise.resolve(ContextualIdentityService.remove(args.userContextId)); + const removed = ContextualIdentityService.remove(args.userContextId); + + this._refreshNeeded(); + return Promise.resolve(removed); }, // Styling the window + configureWindows() { + for (let window of windows.browserWindows) { // eslint-disable-line prefer-const + this.configureWindow(viewFor(window)); + } + }, + configureWindow(window) { const id = windowUtils.getInnerId(window); if (!(id in this._windowMap)) { @@ -492,6 +504,11 @@ const ContainerService = { delete this._windowMap[id]; }, + _refreshNeeded() { + // FIXME: color/name propagation + this.configureWindows(); + }, + _hideAllPanels() { for (let id in this._windowMap) { // eslint-disable-line prefer-const this._windowMap[id].hidePanel();