зеркало из https://github.com/mozilla/gecko-dev.git
Prefs support
This commit is contained in:
Родитель
f65d571f7b
Коммит
d16438323f
|
@ -26,6 +26,7 @@
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
|
||||||
class nsIApplicationShell;
|
class nsIApplicationShell;
|
||||||
|
class nsIPref;
|
||||||
|
|
||||||
#define NS_ISHELLINSTANCE_IID \
|
#define NS_ISHELLINSTANCE_IID \
|
||||||
{ 0xbf88e640, 0xdf99, 0x11d1, \
|
{ 0xbf88e640, 0xdf99, 0x11d1, \
|
||||||
|
@ -113,6 +114,13 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD ExitApplication() = 0 ;
|
NS_IMETHOD ExitApplication() = 0 ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Preferences Object
|
||||||
|
* @result An nsIPref pointer
|
||||||
|
*/
|
||||||
|
NS_IMETHOD_(nsIPref *) GetPreferences() = 0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsIShellInstance_h___ */
|
#endif /* nsIShellInstance_h___ */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
DEPTH=..\..
|
DEPTH=..\..
|
||||||
IGNORE_MANIFEST=1
|
IGNORE_MANIFEST=1
|
||||||
|
|
||||||
DEFINES=-D_IMPL_NS_SHELL -DWIN32_LEAN_AND_MEAN
|
DEFINES=-D_IMPL_NS_SHELL -DWIN32_LEAN_AND_MEAN
|
||||||
MODULE=shell
|
MODULE=shell
|
||||||
|
|
||||||
DIRS = windows
|
DIRS = windows
|
||||||
|
@ -38,7 +38,7 @@ CPP_OBJS= \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
||||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib -I$(PUBLIC)\shell
|
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib -I$(PUBLIC)\shell -I$(PUBLIC)\pref
|
||||||
|
|
||||||
MAKE_OBJ_TYPE = DLL
|
MAKE_OBJ_TYPE = DLL
|
||||||
DLLNAME = shell
|
DLLNAME = shell
|
||||||
|
@ -60,6 +60,7 @@ LLIBS= \
|
||||||
$(DIST)\lib\libplc21.lib \
|
$(DIST)\lib\libplc21.lib \
|
||||||
$(DIST)\lib\jsdom.lib \
|
$(DIST)\lib\jsdom.lib \
|
||||||
$(DIST)\lib\netlib.lib \
|
$(DIST)\lib\netlib.lib \
|
||||||
|
$(DIST)\lib\xppref32.lib \
|
||||||
$(LIBNSPR)
|
$(LIBNSPR)
|
||||||
|
|
||||||
include <$(DEPTH)\config\rules.mak>
|
include <$(DEPTH)\config\rules.mak>
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
#define NS_IMPL_IDS 1
|
||||||
|
|
||||||
#include "nspr.h"
|
#include "nspr.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@
|
||||||
#include "nsGfxCIID.h"
|
#include "nsGfxCIID.h"
|
||||||
#include "nsParserCIID.h"
|
#include "nsParserCIID.h"
|
||||||
|
|
||||||
|
#include "nsIPref.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||||
static NS_DEFINE_IID(kCShellInstance, NS_SHELLINSTANCE_CID);
|
static NS_DEFINE_IID(kCShellInstance, NS_SHELLINSTANCE_CID);
|
||||||
|
@ -67,10 +71,12 @@ private:
|
||||||
nsShellInstance::nsShellInstance()
|
nsShellInstance::nsShellInstance()
|
||||||
{
|
{
|
||||||
mApplicationWindow = NULL;
|
mApplicationWindow = NULL;
|
||||||
|
mPref = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsShellInstance::~nsShellInstance()
|
nsShellInstance::~nsShellInstance()
|
||||||
{
|
{
|
||||||
|
NS_IF_RELEASE(mPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DEFINE_IID(kIShellInstanceIID, NS_ISHELLINSTANCE_IID);
|
NS_DEFINE_IID(kIShellInstanceIID, NS_ISHELLINSTANCE_IID);
|
||||||
|
@ -82,6 +88,13 @@ nsresult nsShellInstance::Init()
|
||||||
|
|
||||||
RegisterFactories() ;
|
RegisterFactories() ;
|
||||||
|
|
||||||
|
// Load preferences
|
||||||
|
res = NSRepository::CreateInstance(kPrefCID, NULL, kIPrefIID,
|
||||||
|
(void **) &mPref);
|
||||||
|
if (NS_OK != res) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +137,11 @@ void * nsShellInstance::GetNativeInstance()
|
||||||
return mNativeInstance ;
|
return mNativeInstance ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIPref * nsShellInstance::GetPreferences()
|
||||||
|
{
|
||||||
|
return (mPref) ;
|
||||||
|
}
|
||||||
|
|
||||||
void nsShellInstance::SetNativeInstance(void * aNativeInstance)
|
void nsShellInstance::SetNativeInstance(void * aNativeInstance)
|
||||||
{
|
{
|
||||||
mNativeInstance = aNativeInstance;
|
mNativeInstance = aNativeInstance;
|
||||||
|
@ -152,10 +170,12 @@ nsresult nsShellInstance::RegisterFactories()
|
||||||
#define GFXWIN_DLL "raptorgfxwin.dll"
|
#define GFXWIN_DLL "raptorgfxwin.dll"
|
||||||
#define WIDGET_DLL "raptorwidget.dll"
|
#define WIDGET_DLL "raptorwidget.dll"
|
||||||
#define PARSER_DLL "raptorhtmlpars.dll"
|
#define PARSER_DLL "raptorhtmlpars.dll"
|
||||||
|
#define PREF_DLL "xppref32.dll"
|
||||||
#else
|
#else
|
||||||
#define GFXWIN_DLL "libgfxunix.so"
|
#define GFXWIN_DLL "libgfxunix.so"
|
||||||
#define WIDGET_DLL "libwidgetunix.so"
|
#define WIDGET_DLL "libwidgetunix.so"
|
||||||
#define PARSER_DLL "libraptorhtmlpars.so"
|
#define PARSER_DLL "libraptorhtmlpars.so"
|
||||||
|
#define PREF_DLL "libpref.so"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,6 +225,8 @@ nsresult nsShellInstance::RegisterFactories()
|
||||||
NSRepository::RegisterFactory(kCTextFieldCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
NSRepository::RegisterFactory(kCTextFieldCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||||
NSRepository::RegisterFactory(kCParserCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
NSRepository::RegisterFactory(kCParserCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
||||||
NSRepository::RegisterFactory(kCParserNodeCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
NSRepository::RegisterFactory(kCParserNodeCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
||||||
|
|
||||||
|
NSRepository::RegisterFactory(kPrefCID, PREF_DLL, PR_FALSE, PR_FALSE);
|
||||||
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
* Reserved.
|
* Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "nsIApplicationShell.h"
|
#include "nsIApplicationShell.h"
|
||||||
#include "nsIFactory.h"
|
#include "nsIFactory.h"
|
||||||
|
@ -23,6 +24,10 @@
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIShellInstance.h"
|
#include "nsIShellInstance.h"
|
||||||
|
|
||||||
|
|
||||||
|
class nsIPref;
|
||||||
|
|
||||||
|
|
||||||
// platform independent native handle to application instance
|
// platform independent native handle to application instance
|
||||||
typedef void * nsNativeApplicationInstance ;
|
typedef void * nsNativeApplicationInstance ;
|
||||||
|
|
||||||
|
@ -126,10 +131,13 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD ExitApplication() ;
|
NS_IMETHOD ExitApplication() ;
|
||||||
|
|
||||||
|
NS_IMETHOD_(nsIPref *) GetPreferences() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsNativeApplicationInstance mNativeInstance ;
|
nsNativeApplicationInstance mNativeInstance ;
|
||||||
nsIApplicationShell * mApplicationShell ;
|
nsIApplicationShell * mApplicationShell ;
|
||||||
nsIWidget * mApplicationWindow ;
|
nsIWidget * mApplicationWindow ;
|
||||||
|
nsIPref * mPref;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ CPP_OBJS= \
|
||||||
.\$(OBJDIR)\winmain.obj \
|
.\$(OBJDIR)\winmain.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor -I$(XPDIST)\public\shell -I$(XPDIST)\public\dom -I$(XPDIST)\public\js -I..
|
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor -I$(XPDIST)\public\shell -I$(XPDIST)\public\pref -I$(XPDIST)\public\dom -I$(XPDIST)\public\js -I..
|
||||||
|
|
||||||
MAKE_OBJ_TYPE = LIB
|
MAKE_OBJ_TYPE = LIB
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ LLIBS= \
|
||||||
$(DIST)\lib\util.lib \
|
$(DIST)\lib\util.lib \
|
||||||
$(DIST)\lib\libplc21.lib \
|
$(DIST)\lib\libplc21.lib \
|
||||||
$(DIST)\lib\jsdom.lib \
|
$(DIST)\lib\jsdom.lib \
|
||||||
|
$(DIST)\lib\xppref32.lib \
|
||||||
$(LIBNSPR)
|
$(LIBNSPR)
|
||||||
|
|
||||||
include <$(DEPTH)\config\rules.mak>
|
include <$(DEPTH)\config\rules.mak>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче