Part of bug 230778 - remove @mozilla.org/preferences;1 from chrome r=caillon sr=jag

This commit is contained in:
neil%parkwaycc.co.uk 2006-05-17 02:36:34 +00:00
Родитель 7e28295e31
Коммит a19ff86b05
7 изменённых файлов: 24 добавлений и 48 удалений

Просмотреть файл

@ -99,7 +99,7 @@
// Default to true in case the preference cannot be retrieved
var forceAlwaysAsk = true;
try {
var prefService = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefService);
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getBranch("browser.helperApps.alwaysAsk.");
forceAlwaysAsk = prefBranch.getBoolPref("force");
} catch(e) {

Просмотреть файл

@ -89,7 +89,7 @@ const xmlSinkObserver = {
// Convert old "don't ask" pref info to helper app pref entries
try {
var prefService = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefService);
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getBranch("browser.helperApps.neverAsk.");
if (!prefBranch) return;
} catch(e) { return; }

Просмотреть файл

@ -1,8 +1,9 @@
//get prefInt services
var availCharsetDict = [];
var prefInt = null; //Preferences Interface
var prefBranch = null; //Preferences Interface
var pref_string_title = "";
var pref_string_object = null;
var pref_string_content = "";
function Init()
@ -12,11 +13,11 @@ function Init()
if ("arguments" in window && window.arguments[0])
applicationArea = window.arguments[0];
prefInt = Components.classes["@mozilla.org/preferences;1"];
if (prefInt) {
prefInt = prefInt.getService(Components.interfaces.nsIPref);
try {
prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
} catch (e) {}
if (prefBranch) {
if (applicationArea == "mailedit") {
pref_string_title = "intl.charsetmenu.mailedit";
} else {
@ -24,7 +25,8 @@ function Init()
pref_string_title = "intl.charsetmenu.browser.static";
}
pref_string_content = prefInt.getLocalizedUnicharPref(pref_string_title);
pref_string_object = prefBranch.getComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString);
pref_string_content = pref_string_object.data;
AddRemoveLatin1('add');
}
@ -286,9 +288,9 @@ function Save()
try
{
if (prefInt) {
prefInt.SetCharPref(pref_string_title, pref_string_content);
window.close();
if (prefBranch) {
pref_string_object.data = pref_string_content;
prefBranch.setComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString, pref_string_object);
}
}
catch(ex) {

Просмотреть файл

@ -37,15 +37,6 @@
*
* ***** END LICENSE BLOCK ***** */
try
{
var pref = Components.classes["@mozilla.org/preferences;1"].getService( Components.interfaces.nsIPref );
}
catch(e)
{
dump("failed to get font list or pref object: "+e+" in pref-fonts.js\n");
}
var fontEnumerator = null;
var globalFonts = null;
var fontTypes = ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
@ -575,7 +566,7 @@ function selectLanguage()
try
{
var minSizePref = "font.minimum-size." + languageList.value;
minSizeVal = pref.GetIntPref( minSizePref );
minSizeVal = parent.hPrefWindow.pref.GetIntPref( minSizePref );
}
catch(e) { }
minSizeSelect( minSizeVal );

Просмотреть файл

@ -34,15 +34,7 @@ function checkEngine()
try
{
var prefInt = null; //Preferences Interface
var strDefaultSearchEngineName;
prefInt = Components.classes["@mozilla.org/preferences;1"];
if (prefInt)
{
prefInt = prefInt.getService(Components.interfaces.nsIPref);
strDefaultSearchEngineName = prefInt.getLocalizedUnicharPref("browser.search.defaultenginename");
}
var strDefaultSearchEngineName = parent.hPrefWindow.pref.getLocalizedUnicharPref("browser.search.defaultenginename");
var engineListSelection = engineList.getElementsByAttribute( "label", strDefaultSearchEngineName );
var selectedItem = engineListSelection.length ? engineListSelection[0] : null;

Просмотреть файл

@ -28,17 +28,7 @@ function moreInfo()
var smartBrowsingURL = regionBundle.getString("smartBrowsingURL");
if (smartBrowsingURL) {
try {
var prefs = Components.classes["@mozilla.org/preferences;1"];
if (prefs) {
prefs = prefs.getService();
if (prefs)
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var url = prefs.CopyCharPref("browser.chromeURL");
if (url)
browserURL = url;
}
browserURL = parent.hPrefWindow.pref.CopyCharPref("browser.chromeURL");
} catch(e) {
}
if (browserURL == null)

Просмотреть файл

@ -58,8 +58,8 @@ function Startup()
gData.loaded = true;
parent.hPrefWindow.registerOKCallbackFunc( applySkin );
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefService;
const kPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
var theme = null;
@ -101,8 +101,8 @@ function applySkin()
if (data.name == null)
return;
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefService;
const kPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
var theme = null;
@ -208,10 +208,11 @@ function themeSelect()
// XXX - this sucks and should only be temporary.
var selectedSkin = "";
try {
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefService;
const kPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
selectedSkin = kPrefSvc.CopyCharPref("general.skins.selectedSkin");
selectedSkin = kPrefSvc.getComplexValue("general.skins.selectedSkin",
Components.interfaces.nsISupportsString).data;
}
catch (e) {
}