4
getPrefBranch: function getPrefBranch()
6
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
7
return prefService.getBranch("refcontrol.");
10
onPopupShowing: function onPopupShowing(aEvent)
12
// onpopupshowing is inherited by child elements.
13
// avoid processing on these
14
if (aEvent.target.id != "refcontrol-popupOptions")
17
var prefBranch = this.getPrefBranch();
20
var arrMenuItems = aEvent.target.getElementsByTagName("menuitem");
21
for (var i = 0; i < arrMenuItems.length; i++)
23
var type = arrMenuItems[i].getAttribute('type');
29
if (type == 'checkbox')
30
bChecked = prefBranch.getBoolPref(arrMenuItems[i].value);
31
else if (type == 'radio')
32
bChecked = (prefBranch.getIntPref(arrMenuItems[i].getAttribute('name')) == arrMenuItems[i].value);
37
arrMenuItems[i].setAttribute("checked", true);
39
arrMenuItems[i].removeAttribute("checked");
47
onChangeCheckboxPref: function onChangeCheckboxPref(aEvent)
49
this.getPrefBranch().setBoolPref(aEvent.target.value, !!aEvent.target.getAttribute('checked'));
52
onChangeRadioPref: function onChangeRadioPref(aEvent)
54
this.getPrefBranch().setIntPref(aEvent.target.getAttribute('name'), aEvent.target.value);
57
toggleBooleanPref: function toggleBooleanPref(aEvent)
60
if (aEvent.target.id == "refcontrol-toolbarbutton")
64
var prefBranch = this.getPrefBranch();
65
prefBranch.setBoolPref(pref, !prefBranch.getBoolPref(pref));