Prefs API changed to use filespecs instead of string paths. Added Get/SetFilePref. Cleaned up the API so that StartUp() does not need to be called.
git-svn-id: svn://10.0.0.236/trunk@28550 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "jsapi.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsFileSpec;
|
||||
|
||||
/* Temporarily conditionally compile PrefChangedFunc typedef.
|
||||
** During migration from old libpref to nsIPref we need it in
|
||||
** both header files. Eventually prefapi.h will become a private
|
||||
@@ -59,24 +61,48 @@ public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPREF_IID)
|
||||
|
||||
// Initialize/shutdown
|
||||
NS_IMETHOD Startup(const char *filename) = 0;
|
||||
NS_IMETHOD Shutdown() = 0;
|
||||
#ifdef PREF_SUPPORT_OLD_PATH_STRINGS
|
||||
nsresult Shutdown() { return ShutDown(); }
|
||||
nsresult Startup(void*) { return StartUp(); }
|
||||
NS_IMETHOD ReadUserJSFile(const char *filename) = 0; // deprecated
|
||||
NS_IMETHOD ReadLIJSFile(const char *filename) = 0; // deprecated
|
||||
NS_IMETHOD EvaluateConfigScript(const char * js_buffer, size_t length,
|
||||
const char* filename,
|
||||
PRBool bGlobalContext,
|
||||
PRBool bCallbacks) = 0; // deprecated
|
||||
NS_IMETHOD SavePrefFileAs(const char *filename) = 0;
|
||||
NS_IMETHOD SaveLIPrefFile(const char *filename) = 0;
|
||||
|
||||
// Path prefs
|
||||
NS_IMETHOD CopyPathPref(const char *pref, char ** return_buf) = 0;
|
||||
NS_IMETHOD SetPathPref(const char *pref_name,
|
||||
const char *path, PRBool set_default) = 0;
|
||||
#endif
|
||||
// Initialize/shut down
|
||||
NS_IMETHOD StartUp() = 0;
|
||||
NS_IMETHOD StartUpWith(const nsFileSpec& inSpec) = 0;
|
||||
NS_IMETHOD ShutDown() = 0;
|
||||
|
||||
// Config file input
|
||||
NS_IMETHOD ReadUserJSFile(const char *filename) = 0;
|
||||
NS_IMETHOD ReadLIJSFile(const char *filename) = 0;
|
||||
NS_IMETHOD ReadUserJSFile(const nsFileSpec& inSpec) = 0;
|
||||
NS_IMETHOD ReadLIJSFile(const nsFileSpec& inSpec) = 0;
|
||||
|
||||
NS_IMETHOD EvaluateConfigScript(const char * js_buffer, size_t length,
|
||||
PRBool bGlobalContext,
|
||||
PRBool bCallbacks) = 0;
|
||||
NS_IMETHOD EvaluateConfigScriptFile(const char * js_buffer, size_t length,
|
||||
const nsFileSpec& inSpec,
|
||||
PRBool bGlobalContext,
|
||||
PRBool bCallbacks) = 0;
|
||||
|
||||
NS_IMETHOD SavePrefFileAs(const nsFileSpec& inSpec) = 0;
|
||||
NS_IMETHOD SaveLIPrefFile(const nsFileSpec& inSpec) = 0;
|
||||
|
||||
// JS stuff
|
||||
NS_IMETHOD GetConfigContext(JSContext **js_context) = 0;
|
||||
NS_IMETHOD GetGlobalConfigObject(JSObject **js_object) = 0;
|
||||
NS_IMETHOD GetPrefConfigObject(JSObject **js_object) = 0;
|
||||
|
||||
NS_IMETHOD EvaluateConfigScript(const char * js_buffer, size_t length,
|
||||
const char* filename,
|
||||
PRBool bGlobalContext,
|
||||
PRBool bCallbacks) = 0;
|
||||
|
||||
// Getters
|
||||
NS_IMETHOD GetCharPref(const char *pref,
|
||||
char * return_buf, int * buf_length) = 0;
|
||||
@@ -140,18 +166,15 @@ public:
|
||||
NS_IMETHOD CopyDefaultBinaryPref(const char *pref,
|
||||
void ** return_val, int * size) = 0;
|
||||
|
||||
// Path prefs
|
||||
NS_IMETHOD CopyPathPref(const char *pref, char ** return_buf) = 0;
|
||||
NS_IMETHOD SetPathPref(const char *pref_name,
|
||||
const char *path, PRBool set_default) = 0;
|
||||
NS_IMETHOD GetFilePref(const char* pref, nsFileSpec* value) = 0;
|
||||
NS_IMETHOD SetFilePref(
|
||||
const char* pref, const nsFileSpec* value, PRBool setDefault) = 0;
|
||||
|
||||
// Pref info
|
||||
NS_IMETHOD PrefIsLocked(const char *pref_name, PRBool *res) = 0;
|
||||
|
||||
// Save pref files
|
||||
NS_IMETHOD SavePrefFile(void) = 0;
|
||||
NS_IMETHOD SavePrefFileAs(const char *filename) = 0;
|
||||
NS_IMETHOD SaveLIPrefFile(const char *filename) = 0;
|
||||
NS_IMETHOD SavePrefFile() = 0;
|
||||
|
||||
// Callbacks
|
||||
NS_IMETHOD RegisterCallback( const char* domain,
|
||||
|
||||
@@ -25,7 +25,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = pref
|
||||
LIBRARY_NAME = pref
|
||||
|
||||
REQUIRES = js pref dbm security ldap img layer xpcom util
|
||||
REQUIRES = js raptorbase pref dbm security ldap img layer xpcom util
|
||||
|
||||
ifneq ($(subst /,_,$(shell uname -s)),OS2)
|
||||
CSRCS = unix/unixpref.c
|
||||
|
||||
@@ -80,6 +80,7 @@ LLIBS = \
|
||||
$(DIST)\lib\plc3.lib \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(HASHLIBS)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
|
||||
/* Data shared between prefapi.c and nsPref.cpp */
|
||||
|
||||
NSPR_BEGIN_EXTERN_C
|
||||
extern JSTaskState * gMochaTaskState;
|
||||
extern JSContext * gMochaContext;
|
||||
extern JSObject * gMochaPrefObject;
|
||||
@@ -40,13 +41,16 @@ extern PLHashTable* gHashTable;
|
||||
extern char * gSavedLine;
|
||||
extern PLHashAllocOps pref_HashAllocOps;
|
||||
|
||||
NSPR_BEGIN_EXTERN_C
|
||||
PR_EXTERN(JSBool) PR_CALLBACK pref_BranchCallback(JSContext *cx, JSScript *script);
|
||||
PR_EXTERN(PrefResult) pref_savePref(PLHashEntry *he, int i, void *arg);
|
||||
PR_EXTERN(PrefResult) pref_saveLIPref(PLHashEntry *he, int i, void *arg);
|
||||
PR_EXTERN(PRBool) pref_VerifyLockFile(char* buf, long buflen);
|
||||
PR_EXTERN(PrefResult) PREF_SetSpecialPrefsLocal(void);
|
||||
PR_EXTERN(int) pref_CompareStrings(const void *v1, const void *v2);
|
||||
/* -- Platform specific function extern */
|
||||
#if !defined(XP_WIN) && !defined(XP_OS2)
|
||||
extern JSBool pref_InitInitialObjects(void);
|
||||
#endif
|
||||
NSPR_END_EXTERN_C
|
||||
|
||||
/* Possibly exportable */
|
||||
|
||||
Reference in New Issue
Block a user