mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Combine clear global history and clear location bar history prefs.
This commit is contained in:
parent
f650dbcdba
commit
ec3e5b629f
@ -37,26 +37,17 @@
|
||||
|
||||
function Startup()
|
||||
{
|
||||
var urlbarHistButton = document.getElementById("ClearUrlBarHistoryButton");
|
||||
var clearHistButton = document.getElementById("browserClearHistory");
|
||||
try {
|
||||
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(urlbarHistButton.getAttribute("prefstring"));
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var lastUrl = pref.getComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsWString).data;
|
||||
urlbarHistButton.disabled = ( urlBarHist.count == 0 && !lastUrl ) || isBtnLocked ;
|
||||
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(clearHistButton.getAttribute("prefstring"));
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
clearHistButton.disabled = ( urlBarHist.count == 0 && globalHistory.count == 0) || isBtnLocked;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
|
||||
var globalHistButton = document.getElementById("browserClearHistory");
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
if (globalHistory.count == 0)
|
||||
globalHistButton.disabled = true;
|
||||
|
||||
}
|
||||
|
||||
function prefClearGlobalHistory()
|
||||
@ -64,22 +55,9 @@
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
globalHistory.removeAllPages();
|
||||
}
|
||||
|
||||
function prefClearUrlbarHistory()
|
||||
{
|
||||
var button = document.getElementById("ClearUrlBarHistoryButton");
|
||||
var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
urlBarHistory.clearHistory();
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var str = Components.classes["@mozilla.org/supports-wstring;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsWString);
|
||||
str.data = "";
|
||||
pref.setComplexValue("general.open_location.last_url",
|
||||
Components.interfaces.nsISupportsWString,
|
||||
str);
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
@ -98,19 +76,6 @@
|
||||
id="browserClearHistory"
|
||||
prefstring="pref.browser.history.disable_button.clear_hist"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<!-- no honey, I haven't been viewing porn, honest! -->
|
||||
<groupbox>
|
||||
<caption label="&locationBarHistory.label;"/>
|
||||
<hbox align="center">
|
||||
<description flex="1">&clearLocationBar.label;</description>
|
||||
<hbox align="center" pack="end">
|
||||
<button id="ClearUrlBarHistoryButton" label="&clearLocationBarButton.label;" accesskey="&clearLocationBarButton.accesskey;"
|
||||
oncommand="prefClearUrlbarHistory(); this.disabled = true;"
|
||||
prefstring="pref.browser.history.disable_button.clear_urlbar"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</groupbox>
|
||||
</page>
|
||||
|
||||
|
@ -6,10 +6,4 @@
|
||||
<!ENTITY pageHis.accesskey "p">
|
||||
<!ENTITY days.label "days">
|
||||
<!ENTITY clearHistory.label "Clear History">
|
||||
<!ENTITY clearHistory.accesskey "r">
|
||||
|
||||
<!ENTITY locationBarHistory.label "Location Bar History">
|
||||
<!ENTITY clearLocationBar.label "Clear the list of sites stored in the location bar menu.">
|
||||
<!ENTITY clearLocationBarButton.label "Clear Location Bar">
|
||||
<!ENTITY clearLocationBarButton.accesskey "b">
|
||||
|
||||
<!ENTITY clearHistory.accesskey "r">
|
Loading…
Reference in New Issue
Block a user