mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 559942, Part 4: UI change allowing user to turn smart sizing on or off.
r=gavin, a=beta6+
This commit is contained in:
parent
c445727468
commit
4d7b0becf6
@ -69,6 +69,7 @@ var gAdvancedPane = {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
this.initSubmitCrashes();
|
||||
#endif
|
||||
this.updateActualCacheSize();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -178,6 +179,8 @@ var gAdvancedPane = {
|
||||
*
|
||||
* browser.cache.disk.capacity
|
||||
* - the size of the browser cache in KB
|
||||
* browser.cache.disk.smart_size.enabled
|
||||
* - If disabled, disk.capacity is used
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -188,7 +191,50 @@ var gAdvancedPane = {
|
||||
document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
|
||||
"", null);
|
||||
},
|
||||
|
||||
// Retrieves the amount of space currently used by disk cache
|
||||
updateActualCacheSize: function ()
|
||||
{
|
||||
var visitor = {
|
||||
visitDevice: function (deviceID, deviceInfo)
|
||||
{
|
||||
if (deviceID == "disk") {
|
||||
var actualSizeLabel = document.getElementById("actualCacheSize");
|
||||
var sizeStrings = DownloadUtils.convertByteUnits(deviceInfo.totalSize);
|
||||
var prefStrBundle = document.getElementById("bundlePreferences");
|
||||
var sizeStr = prefStrBundle.getFormattedString("actualCacheSize",
|
||||
sizeStrings);
|
||||
actualSizeLabel.value = sizeStr;
|
||||
}
|
||||
// Do not enumerate entries
|
||||
return false;
|
||||
},
|
||||
|
||||
visitEntry: function (deviceID, entryInfo)
|
||||
{
|
||||
// Do not enumerate entries.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var cacheService =
|
||||
Components.classes["@mozilla.org/network/cache-service;1"]
|
||||
.getService(Components.interfaces.nsICacheService);
|
||||
cacheService.visitEntries(visitor);
|
||||
},
|
||||
|
||||
updateCacheSizeUI: function (smartSizeEnabled)
|
||||
{
|
||||
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
|
||||
document.getElementById("cacheSize").disabled = smartSizeEnabled;
|
||||
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
|
||||
},
|
||||
|
||||
readSmartSizeEnabled: function ()
|
||||
{
|
||||
var enabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
|
||||
this.updateCacheSizeUI(enabled);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the cache size from units of KB to units of MB and returns that
|
||||
* value.
|
||||
@ -220,6 +266,7 @@ var gAdvancedPane = {
|
||||
try {
|
||||
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
|
||||
} catch(ex) {}
|
||||
this.updateActualCacheSize();
|
||||
},
|
||||
|
||||
readOfflineNotify: function()
|
||||
|
@ -86,8 +86,12 @@
|
||||
<!-- Network tab -->
|
||||
<preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" type="int"/>
|
||||
<preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/>
|
||||
|
||||
<!-- Update tab -->
|
||||
|
||||
<preference id="browser.cache.disk.smart_size.enabled"
|
||||
name="browser.cache.disk.smart_size.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- Update tab -->
|
||||
#ifdef MOZ_UPDATER
|
||||
<preference id="app.update.enabled" name="app.update.enabled" type="bool"
|
||||
onchange="gAdvancedPane.updateAppUpdateItems();
|
||||
@ -232,8 +236,18 @@
|
||||
<!-- Cache/Offline apps -->
|
||||
<groupbox id="offlineGroup">
|
||||
<caption label="&offlineStorage.label;"/>
|
||||
|
||||
|
||||
<hbox align="center">
|
||||
<label id="actualCacheSize" flex="1"/>
|
||||
<button id="clearCacheButton" icon="clear"
|
||||
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
|
||||
oncommand="gAdvancedPane.clearCache();"/>
|
||||
</hbox>
|
||||
<checkbox preference="browser.cache.disk.smart_size.enabled"
|
||||
id="allowSmartSize" flex="1"
|
||||
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
|
||||
label="&smartSizeCache.label;"/>
|
||||
<hbox align="center" class="indent">
|
||||
<label id="useCacheBefore" control="cacheSize"
|
||||
accesskey="&useCacheBefore.accesskey;" value="&useCacheBefore.label;"/>
|
||||
<textbox id="cacheSize" type="number" size="2"
|
||||
@ -242,9 +256,6 @@
|
||||
onsynctopreference="return gAdvancedPane.writeCacheSize();"
|
||||
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
|
||||
<label id="useCacheAfter" flex="1">&useCacheAfter.label;</label>
|
||||
<button id="clearCacheButton" icon="clear"
|
||||
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
|
||||
oncommand="gAdvancedPane.clearCache();"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<checkbox id="offlineNotify" flex="1"
|
||||
|
@ -51,6 +51,7 @@
|
||||
<!ENTITY useCacheAfter.label "MB of space for the cache">
|
||||
<!ENTITY clearCacheNow.label "Clear Now">
|
||||
<!ENTITY clearCacheNow.accesskey "C">
|
||||
<!ENTITY smartSizeCache.label "Let &brandShortName; manage the size of my cache.">
|
||||
|
||||
<!ENTITY updateTab.label "Update">
|
||||
|
||||
|
@ -104,6 +104,12 @@ offlineAppUsage=%1$S %2$S
|
||||
offlinepermissionstext=The following websites are not allowed to store data for offline use:
|
||||
offlinepermissionstitle=Offline Data
|
||||
|
||||
####Preferences::Advanced::Network
|
||||
#LOCALIZATION NOTE: The next string is for the disk usage of the http cache.
|
||||
# e.g., "Your cache is currently using 200 MB"
|
||||
# %1$S = size
|
||||
# %2$S = unit (MB, KB, etc.)
|
||||
actualCacheSize=Your cache is currently using %1$S %2$S of disk space
|
||||
|
||||
#### Syncing
|
||||
connect.label=Connect
|
||||
|
@ -60,6 +60,11 @@ pref("general.warnOnAboutConfig", true);
|
||||
pref("browser.bookmarks.max_backups", 5);
|
||||
|
||||
pref("browser.cache.disk.enable", true);
|
||||
// Is this the first-time smartsizing has been introduced?
|
||||
pref("browser.cache.disk.smart_size.first_run", true);
|
||||
// Does the user want smart-sizing?
|
||||
pref("browser.cache.disk.smart_size.enabled", true);
|
||||
// Size explicitly set by the user. Used when smart_size.enabled == false
|
||||
#ifndef WINCE
|
||||
pref("browser.cache.disk.capacity", 256000);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user