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