NOT PART OF SEAMONKEY. Ressurect GtkMozilla again. Apparently mozilla

dont work no without no prefs.  Blessed by Mr. Shaver.
This commit is contained in:
ramiro%netscape.com 1999-09-28 18:03:17 +00:00
Родитель d702d927b7
Коммит 6dd1b8db08
3 изменённых файлов: 94 добавлений и 22 удалений

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

@ -27,15 +27,25 @@
#include "nsIContentViewer.h"
#include "prprf.h"
#include "nsIPref.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID);
static NS_DEFINE_IID(kIDocumentLoaderFactoryIID, NS_IDOCUMENTLOADERFACTORY_IID);
GtkMozillaContainer::GtkMozillaContainer(GtkMozilla *moz)
// static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
// static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
GtkMozillaContainer::GtkMozillaContainer(GtkMozilla *moz, nsIPref * aPrefs)
{
mWebShell = nsnull;
width = height = 0;
mStream = nsnull;
@ -45,12 +55,23 @@ GtkMozillaContainer::GtkMozillaContainer(GtkMozilla *moz)
mozilla = moz;
gtk_widget_set_app_paintable(GTK_WIDGET(moz), PR_TRUE);
mPrefs = aPrefs;
NS_IF_ADDREF(mPrefs);
}
GtkMozillaContainer::~GtkMozillaContainer(void)
{
NS_IF_RELEASE(mWebShell);
NS_IF_RELEASE(mPrefs);
// if (nsnull != mPrefs)
// {
// mPrefs->ShutDown();
// NS_RELEASE(mPrefs);
// }
}
void
@ -58,27 +79,55 @@ GtkMozillaContainer::Show()
{
GtkAllocation *alloc = &GTK_WIDGET(mozilla)->allocation;
nsresult rv = nsRepository::CreateInstance(kWebShellCID, nsnull,
kIWebShellIID,
(void**)&mWebShell);
if (NS_FAILED(rv) || !mWebShell) {
printf("Cannot create WebShell!");
nsresult rv = nsRepository::CreateInstance(kWebShellCID,
nsnull,
kIWebShellIID,
(void**) &mWebShell);
if (NS_FAILED(rv) || !mWebShell)
{
printf("Cannot create WebShell!\n");
return;
}
// rv = nsComponentManager::CreateInstance(kPrefCID,
// nsnull,
// kIPrefIID,
// (void **) &mPrefs);
if (mozilla) {
// if (NS_OK != rv)
// {
// printf("Cannot create Prefs!\n");
// return rv;
// }
// mPrefs->StartUp();
// mPrefs->ReadUserPrefs();
if (mozilla)
{
width = alloc->width;
height = alloc->height;
//printf("Init, size: %d, %d\n", width, height);
mWebShell->Init((nsNativeWidget *)mozilla,
0, 0,
width, height);
0,
0,
width,
height);
mWebShell->SetContainer(this);
if(mPrefs)
{
mWebShell->SetPrefs(mPrefs);
}
}
if (mWebShell) {
if (mWebShell)
{
mWebShell->Show();
}
}

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

@ -24,6 +24,7 @@
class nsIWebShell;
class nsIPref;
class GtkMozillaContainer : public nsIWebShellContainer
{
@ -64,7 +65,7 @@ public:
// Construction
GtkMozillaContainer(GtkMozilla *moz); // standard constructor
GtkMozillaContainer(GtkMozilla *moz, nsIPref * aPrefs); // standard constructor
virtual ~GtkMozillaContainer();
void Show();
@ -103,6 +104,8 @@ protected:
nsIContentViewer** aDocViewerResult);
nsIWebShell *mWebShell;
nsIPref *mPrefs;
GtkMozilla *mozilla;
int width, height;

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

@ -20,6 +20,8 @@
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsIPref.h"
#ifndef NECKO
#include "nsINetService.h"
#else
@ -27,10 +29,10 @@
#endif // NECKO
//#include "nsXPComCIID.h"
static NS_DEFINE_IID(kIEventQueueServiceIID,
NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kEventQueueServiceCID,
NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kIEventQueueServiceIID,NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kEventQueueServiceCID,NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
extern "C" void NS_SetupRegistry();
@ -133,6 +135,12 @@ gtk_mozilla_realize (GtkWidget *widget)
moz_container->Show();
}
// THIS is a total hack. Needed cause mozilla wont work without prefs
// no more. Having the prefs be static over here is bad and a better
// fix is to make them members of some kind of structure which gets
// cleaned up at shutdown time.
static nsIPref * sPrefs = nsnull;
static void
gtk_mozilla_init (GtkMozilla *moz)
{
@ -145,7 +153,7 @@ gtk_mozilla_init (GtkMozilla *moz)
GTK_WIDGET_SET_FLAGS (GTK_WIDGET(moz), GTK_CAN_FOCUS);
moz->mozilla_container = new GtkMozillaContainer(moz);
moz->mozilla_container = new GtkMozillaContainer(moz,sPrefs);
}
static void event_processor_callback(gpointer data,
@ -211,11 +219,23 @@ gtk_mozilla_get_type (void)
NS_RELEASE(aEventQService);
//printf("Initializing NetService.\n");
#ifndef NECKO
NS_InitINetService();
#endif
// Prefs
rv = nsComponentManager::CreateInstance(kPrefCID,
NULL,
kIPrefIID,
(void **) & sPrefs);
if (NS_OK != rv)
{
printf("Could not create the pref thing.\n");
return rv;
}
printf("prefs created ok.\n");
sPrefs->StartUp();
sPrefs->ReadUserPrefs();
gdk_input_add(EQueue->GetEventQueueSelectFD(),
GDK_INPUT_READ,