Bug 580919 - Fold Storage.saveVisibilityData into saveUIData

This commit is contained in:
Raymond Lee 2010-07-23 10:05:22 +08:00
parent 66708b572d
commit b116ab9675
2 changed files with 10 additions and 35 deletions

View File

@ -110,7 +110,6 @@ Storage = {
// ___ Other
this.saveGroupsData(gWindow, {});
this.saveUIData(gWindow, {});
this.saveVisibilityData(gWindow, {});
this._sessionStore.setWindowValue(gWindow, this.GROUP_DATA_IDENTIFIER,
JSON.stringify({}));
@ -217,20 +216,6 @@ Storage = {
return this.readData(win, this.UI_DATA_IDENTIFIER);
},
// ----------
// Function: saveVisibilityData
// TODO: fold into saveUIData
saveVisibilityData: function(win, data) {
this.saveData(win, this.VISIBILITY_DATA_IDENTIFIER, data);
},
// ----------
// Function: readVisibilityData
// TODO: fold into readUIData
readVisibilityData: function(win) {
return this.readData(win, this.VISIBILITY_DATA_IDENTIFIER);
},
// ----------
// Function: saveData
// Generic routine for saving data to a window.
@ -264,4 +249,3 @@ Storage = {
// ----------
Storage.init();

View File

@ -772,8 +772,7 @@ UIClass.prototype = {
});
// ___ show tab candy at startup
var visibilityData = Storage.readVisibilityData(gWindow);
if (visibilityData && visibilityData.visible) {
if (data.tabCandyVisible) {
var currentTab = UI.currentTab;
var item;
@ -796,10 +795,8 @@ UIClass.prototype = {
if (topic == "quit-application-requested") {
if (Page.isTabCandyVisible()) {
TabItems.saveAll(true);
self._saveVisibility(true);
} else {
self._saveVisibility(false);
}
self._save();
}
}
};
@ -1151,16 +1148,6 @@ UIClass.prototype = {
location.href = '';
},
// ----------
// Function: _saveAll
// Saves all data associated with TabCandy.
// TODO: Save info items
_saveAll: function() {
this._save();
Groups.saveAll();
TabItems.saveAll();
},
// ----------
// Function: _save
// Saves the data for this object to persistent storage
@ -1169,6 +1156,7 @@ UIClass.prototype = {
return;
var data = {
tabCandyVisible: Page.isTabCandyVisible(),
pageBounds: this.pageBounds
};
@ -1193,10 +1181,13 @@ UIClass.prototype = {
},
// ----------
// Function: _saveVisibility
// Saves to storage whether the TabCandy UI is visible (as passed in).
_saveVisibility: function(isVisible) {
Storage.saveVisibilityData(gWindow, { visible: isVisible });
// Function: _saveAll
// Saves all data associated with TabCandy.
// TODO: Save info items
_saveAll: function() {
this._save();
Groups.saveAll();
TabItems.saveAll();
},
// ----------