From 9234e33e7c37404713cbfdba9a954d3055d7abc5 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Tue, 7 Mar 2000 01:01:48 +0000 Subject: [PATCH] add nsIPrefService, update nsIPrefBranch to add some functions I missed (not part of build) --- modules/libpref/public/nsIPrefBranch.idl | 28 +++++++++- modules/libpref/public/nsIPrefService.idl | 63 +++++++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 modules/libpref/public/nsIPrefService.idl diff --git a/modules/libpref/public/nsIPrefBranch.idl b/modules/libpref/public/nsIPrefBranch.idl index ef17c67d21d9..ff0a3a362ba9 100644 --- a/modules/libpref/public/nsIPrefBranch.idl +++ b/modules/libpref/public/nsIPrefBranch.idl @@ -25,11 +25,31 @@ #include "nsIFileSpec.idl" #include "nsIPrefListener.idl" +%{C++ + +typedef int (*PrefChangedFunc)(const char *, void *); +typedef void (*PrefEnumerationFunc)(const char *, void *); + +%} + + native PrefEnumerationFunc(PrefEnumerationFunc); +native PrefChangedFunc(PrefChangedFunc); [scriptable, uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65)] interface nsIPrefBranch : nsISupports { + const long ePrefInvalid = 0; + const long ePrefLocked = 1; + const long ePrefUserset = 2; + const long ePrefConfig = 4; + const long ePrefRemote = 8; + const long ePrefLilocal = 16; + const long ePrefString = 32; + const long ePrefInt = 64; + const long ePrefBool = 128; + const long ePrefValuetypeMask = (ePrefString | ePrefInt | ePrefBool); + /** * the root of this branch, such as "browser." */ @@ -38,6 +58,8 @@ interface nsIPrefBranch : nsISupports /* * standard methods for accessing prefs */ + PRInt32 getPrefType(in string prefName); + boolean getBoolPref(in string prefName); void setBoolPref(in string prefName, in long value); @@ -54,6 +76,8 @@ interface nsIPrefBranch : nsISupports nsIFileSpec getFileSpecPref(in string prefName); void setFileSpecPref(in string prefName, in nsIFileSpec value); + boolean prefIsLocked(in string pref); + void clearPref(in string prefName); /* do we need other prefs like color, rect, etc? @@ -64,10 +88,10 @@ interface nsIPrefBranch : nsISupports * same as above but for getting default prefs */ boolean getDefaultBoolPref(in string prefName); - void setDefaultBoolPref(in string prefName in boolean value); + void setDefaultBoolPref(in string prefName, in boolean value); long getDefaultIntPref(in string prefName); - void setDefaultIntPref(in string prefName, in long value) + void setDefaultIntPref(in string prefName, in long value); string getDefaultCharPref(in string prefName); void setDefaultCharPref(in string prefName, in string value); diff --git a/modules/libpref/public/nsIPrefService.idl b/modules/libpref/public/nsIPrefService.idl new file mode 100644 index 000000000000..8144047b01e5 --- /dev/null +++ b/modules/libpref/public/nsIPrefService.idl @@ -0,0 +1,63 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Alec Flett + */ + +#include "nsISupports.idl" +#include "nsIPrefBranch.idl" + +[scriptable, uuid(decb9cc7-c08f-4ea5-be91-a8fc637ce2d2)] +interface nsIPrefService : nsISupports +{ + + // Initialize/shutdown + void StartUp(); + void ReadUserPrefs(); + void ReadUserPrefsFrom(in nsIFileSpec spec); + // void ResetPrefs(); + void ShutDown(); + + // Config file input + void ReadUserJSFile(in nsIFileSpec filename); + + // Commenting out: #ifdef MOZ_OLD_LI_STUFF + // void ReadLIJSFile(in nsIFileSpec filename); + + /* + void EvaluateConfigScript(in string js_buffer, in PRUint32 length, + in boolean bGlobalContext, + in boolean bCallbacks); + + void EvaluateConfigScriptFile(in string js_buffer, in PRUint32 length, + in nsIFileSpec filename, + in boolean bGlobalContext, + in boolean bCallbacks); + void SavePrefFileAs(in nsIFileSpec filename); + */ + /* JS Stuff - don't allow this to be scriptable */ + //[noscript] readonly attribute JSContext configContext; + //[noscript] readonly attribute JSObject globalConfigObject; + // [noscript] readonly attribute JSObject prefConfigObject; + + nsIPrefBranch getBranch(in string root); + +}; +