summaryrefslogtreecommitdiff
path: root/toolkit/content
diff options
context:
space:
mode:
authorwsdfhjxc <wsdfhjxc@protonmail.com>2017-04-17 18:59:05 +0200
committerwsdfhjxc <wsdfhjxc@protonmail.com>2017-04-17 18:59:05 +0200
commit24f32046a33734c657a677590e76bc96b7505533 (patch)
treea2cc76e8811ecb94840a276200dce74d14ee8b0e /toolkit/content
parentbc3ec348c459def828482fc5b683cbbc4cdc72ef (diff)
downloadpalemoon-gre-24f32046a33734c657a677590e76bc96b7505533.tar.gz
Simplify two prefs into one multi-valued pref
Diffstat (limited to 'toolkit/content')
-rw-r--r--toolkit/content/widgets/findbar.xml55
1 files changed, 25 insertions, 30 deletions
diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml
index 7dba6b40b..725161c42 100644
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -322,11 +322,8 @@
case "accessibility.typeaheadfind.casesensitive":
this._self._setCaseSensitivity(prefsvc.getIntPref(aPrefName));
break;
- case "accessibility.typeaheadfind.highlightallbydefault":
- this._self._typeAheadHighlightAllByDefault = prefsvc.getBoolPref(aPrefName);
- break;
- case "accessibility.typeaheadfind.highlightallremember":
- this._self._typeAheadHighlightAllRemember = prefsvc.getBoolPref(aPrefName);
+ case "accessibility.typeaheadfind.highlightAllBehavior":
+ this._self._typeAheadHighlightAllBehavior = prefsvc.getIntPref(aPrefName);
break;
}
}
@@ -362,9 +359,7 @@
this._observer, false);
prefsvc.addObserver("accessibility.typeaheadfind.casesensitive",
this._observer, false);
- prefsvc.addObserver("accessibility.typeaheadfind.highlightallbydefault",
- this._observer, false);
- prefsvc.addObserver("accessibility.typeaheadfind.highlightallremember",
+ prefsvc.addObserver("accessibility.typeaheadfind.highlightAllBehavior",
this._observer, false);
this._useTypeAheadFind =
@@ -373,10 +368,8 @@
prefsvc.getBoolPref("accessibility.typeaheadfind.linksonly");
this._typeAheadCaseSensitive =
prefsvc.getIntPref("accessibility.typeaheadfind.casesensitive");
- this._typeAheadHighlightAllByDefault =
- prefsvc.getBoolPref("accessibility.typeaheadfind.highlightallbydefault");
- this._typeAheadHighlightAllRemember =
- prefsvc.getBoolPref("accessibility.typeaheadfind.highlightallremember");
+ this._typeAheadHighlightAllBehavior =
+ prefsvc.getIntPref("accessibility.typeaheadfind.highlightAllBehavior");
// Convenience
this.nsITypeAheadFind = Components.interfaces.nsITypeAheadFind;
@@ -415,22 +408,20 @@
this._observer);
prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive",
this._observer);
- prefsvc.removeObserver("accessibility.typeaheadfind.highlightallbydefault",
- this._observer);
- prefsvc.removeObserver("accessibility.typeaheadfind.highlightallremember",
+ prefsvc.removeObserver("accessibility.typeaheadfind.highlightAllBehavior",
this._observer);
// Clear all timers that might still be running.
this._cancelTimers();
// If the "highlight all" option state should be remembered,
- // then the preference to highlight all by default gets
- // overwritten with the current state, just before destroying
- // which usually happens while closing a browser window
- if (this._typeAheadHighlightAllRemember) {
- let pref = "accessibility.typeaheadfind.highlightallbydefault";
- let state = this.getElement("highlight").checked;
- prefsvc.setBoolPref(pref, state);
+ // then the preference gets overwritten with the current
+ // state (on = 2, off = 3), just before destroying which
+ // usually happens while closing a browser window
+ if (this._typeAheadHighlightAllBehavior > 1) {
+ let pref = "accessibility.typeaheadfind.highlightAllBehavior";
+ let state = this.getElement("highlight").checked ? 2 : 3;
+ prefsvc.setIntPref(pref, state);
}
]]></body>
</method>
@@ -671,14 +662,14 @@
this.toggleHighlight(false);
// If the "highlight all" option state should be remembered,
- // then the preference to highlight all by default gets
- // overwritten with the current state, just before closing
- if (this._typeAheadHighlightAllRemember) {
+ // then the preference gets overwritten with the current
+ // state (on = 2, off = 3), just before closing
+ if (this._typeAheadHighlightAllBehavior > 1) {
let prefsvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
- let pref = "accessibility.typeaheadfind.highlightallbydefault";
- let state = this.getElement("highlight").checked;
- prefsvc.setBoolPref(pref, state);
+ let pref = "accessibility.typeaheadfind.highlightAllBehavior";
+ let state = this.getElement("highlight").checked ? 2 : 3;
+ prefsvc.setIntPref(pref, state);
}
this._findFailedString = null;
@@ -937,9 +928,13 @@
this.getElement("find-previous").hidden = showMinimalUI;
this._updateCaseSensitivity();
- this.getElement("highlight").checked = this._typeAheadHighlightAllByDefault;
- if (this._typeAheadHighlightAllByDefault)
+ if (this._typeAheadHighlightAllBehavior == 1 ||
+ this._typeAheadHighlightAllBehavior == 2) {
+ this.getElement("highlight").checked = true;
this.toggleHighlight(true);
+ } else {
+ this.getElement("highlight").checked = false;
+ }
if (showMinimalUI)
this._findField.classList.add("minimal");