Restore per-window auto hide mode correctly

This commit is contained in:
Piro / YUKI Hiroshi 2015-03-03 23:11:55 +09:00
parent 8a1e2f20fa
commit 95c403efa0
2 changed files with 17 additions and 5 deletions

View File

@ -14,7 +14,7 @@
* The Original Code is the Tree Style Tab. * The Original Code is the Tree Style Tab.
* *
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi. * The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
* Portions created by the Initial Developer are Copyright (C) 2010-2014 * Portions created by the Initial Developer are Copyright (C) 2010-2015
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
* *
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com> * Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com>
@ -1412,12 +1412,14 @@ AutoHideWindow.prototype = inherit(AutoHideConstants, {
}); });
}, },
restoreLastState: function AHW_restoreLastState() restoreLastMode : function AHW_restoreLastMode()
{ {
var mode = this.treeStyleTab.isFullscreenAutoHide ? var mode = this.treeStyleTab.isFullscreenAutoHide ?
utils.getTreePref('tabbar.autoHide.mode.fullscreen') : utils.getTreePref('tabbar.autoHide.mode.fullscreen') :
this.lastMode; this.lastMode;
dump('\n\n\nrestoreLastMode\n\n');
dump(mode +' <=> '+this.mode+'\n\n\n');
if (mode == this.mode) if (mode == this.mode)
return; return;
@ -1481,16 +1483,28 @@ AutoHideWindow.prototype = inherit(AutoHideConstants, {
this.document = aWindow.document; this.document = aWindow.document;
this.treeStyleTab = aWindow.TreeStyleTabService; this.treeStyleTab = aWindow.TreeStyleTabService;
prefs.addPrefListener(this); prefs.addPrefListener(this);
aWindow.addEventListener('SSWindowStateReady', this, false);
}, },
destroy : function AHW_destroy() destroy : function AHW_destroy()
{ {
this.window.removeEventListener('SSWindowStateReady', this, false);
prefs.removePrefListener(this); prefs.removePrefListener(this);
delete this.treeStyleTab; delete this.treeStyleTab;
delete this.document; delete this.document;
delete this.window; delete this.window;
}, },
handleEvent : function AHW_handleEvent(aEvent)
{
switch (aEvent.type)
{
case 'SSWindowStateReady':
this.restoreLastMode();
return;
}
},
domains : [ domains : [
'extensions.treestyletab.', 'extensions.treestyletab.',
'browser.ctrlTab.previews' 'browser.ctrlTab.previews'

View File

@ -419,9 +419,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
this.processRestoredTabs(); this.processRestoredTabs();
this.updateTabsOnTop(); this.updateTabsOnTop();
w.setTimeout(function(aSelf) { this.autoHideWindow; // initialize
aSelf.autoHideWindow.restoreLastState();
}, 0, this);
this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut'); this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut');