Bug 575896 - Reset bookmarks toolbar view during customization. r=dao

This commit is contained in:
Marco Bonardo 2010-07-15 22:38:05 +02:00
parent db29d29142
commit cadd86f1ea
2 changed files with 17 additions and 22 deletions

View File

@ -1067,30 +1067,24 @@ var PlacesStarButton = {
// after closing the toolbar customization dialog.
let PlacesToolbarHelper = {
_place: "place:folder=TOOLBAR",
_cachedElt: null,
onBrowserWindowClose: function PTH_onBrowserWindowClose() {
if (this._cachedElt)
this._cachedElt._placesView.uninit();
get _viewElt() {
return document.getElementById("PlacesToolbar");
},
updateState: function PTH_updateState() {
let currentElt = document.getElementById("PlacesToolbar");
// Bail out if the state has not changed.
if (currentElt == this._cachedElt)
return;
if (!this._cachedElt) {
// The toolbar has been added.
init: function PTH_init() {
if (this._viewElt)
new PlacesToolbar(this._place);
this._cachedElt = currentElt;
}
else {
// The toolbar has been removed.
this._cachedElt._placesView.uninit();
this._cachedElt = null;
}
},
customizeStart: function PTH_customizeStart() {
let viewElt = this._viewElt;
if (viewElt && viewElt._placesView)
viewElt._placesView.uninit();
},
customizeDone: function PTH_customizeDone() {
this.init();
}
};

View File

@ -1419,7 +1419,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
dump("nsSessionStore could not be initialized: " + ex + "\n");
}
PlacesToolbarHelper.updateState();
PlacesToolbarHelper.init();
// bookmark-all-tabs command
gBookmarkAllTabsHandler.init();
@ -3420,6 +3420,7 @@ function BrowserCustomizeToolbar()
CombinedStopReload.uninit();
PlacesToolbarHelper.customizeStart();
BookmarksMenuButton.customizeStart();
var customizeURL = "chrome://global/content/customizeToolbar.xul";
@ -3483,7 +3484,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
#endif
}
PlacesToolbarHelper.updateState();
PlacesToolbarHelper.customizeDone();
BookmarksMenuButton.customizeDone();
UpdateUrlbarSearchSplitterState();