From ef23a412ce8e639e4efddc029f31af70040766d8 Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Fri, 27 Aug 1999 06:21:43 +0000 Subject: [PATCH] Remove the depenency on the toolkit service. --- webshell/tests/viewer/unix/gtk/nsGtkMain.cpp | 41 +++---------- .../tests/viewer/unix/motif/nsMotifMain.cpp | 36 +----------- webshell/tests/viewer/unix/qt/nsQtMain.cpp | 58 ++++--------------- .../tests/viewer/unix/xlib/nsXlibMain.cpp | 36 +----------- 4 files changed, 21 insertions(+), 150 deletions(-) diff --git a/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp b/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp index dc999746c933..3b36392db06c 100644 --- a/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp +++ b/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp @@ -25,11 +25,6 @@ #include #include "plevent.h" -#include "nsIUnixToolkitService.h" -#include "nsIComponentManager.h" - -static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID); - static nsNativeViewerApp* gTheApp; nsNativeViewerApp::nsNativeViewerApp() @@ -91,36 +86,14 @@ int main(int argc, char **argv) gTheApp = new nsNativeViewerApp(); - ////////////////////////////////////////////////////////////////////// - // - // Toolkit Service setup - // - // Note: This must happend before NS_SetupRegistry() is called so - // that the toolkit specific xpcom components can be registered - // as needed. - // - ////////////////////////////////////////////////////////////////////// - nsIUnixToolkitService * unixToolkitService = nsnull; - - nsresult rv = - nsComponentManager::CreateInstance(kCUnixToolkitServiceCID, - nsnull, - nsIUnixToolkitService::GetIID(), - (void **) &unixToolkitService); - - NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); + // Damn, there's no PR_PutEnv() ??? + //PR_PutEnv("MOZ_TOOLKIT=gtk"); - if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService)) - { - // Force the toolkit into "gtk" mode - unixToolkitService->SetToolkitName("gtk"); - - NS_RELEASE(unixToolkitService); - } - - ////////////////////////////////////////////////////////////////////// - // End toolkit service setup - ////////////////////////////////////////////////////////////////////// + // The toolkit service in mozilla will look in the environment + // to determine which toolkit to use. Yes, it is a dumb hack to + // force it here, but we have no choice because of toolkit specific + // code linked into the viewer. + putenv("MOZ_TOOLKIT=gtk"); gTheApp->Initialize(argc, argv); gTheApp->Run(); diff --git a/webshell/tests/viewer/unix/motif/nsMotifMain.cpp b/webshell/tests/viewer/unix/motif/nsMotifMain.cpp index 26648d7d6671..3b97c749a607 100644 --- a/webshell/tests/viewer/unix/motif/nsMotifMain.cpp +++ b/webshell/tests/viewer/unix/motif/nsMotifMain.cpp @@ -21,11 +21,6 @@ #include "nsMotifMenu.h" #include "nsIImageManager.h" -#include "nsIUnixToolkitService.h" -#include "nsIComponentManager.h" - -static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID); - static nsNativeViewerApp* gTheApp; nsNativeViewerApp::nsNativeViewerApp() @@ -96,36 +91,7 @@ int main(int argc, char **argv) gTheApp = new nsNativeViewerApp(); - ////////////////////////////////////////////////////////////////////// - // - // Toolkit Service setup - // - // Note: This must happend before NS_SetupRegistry() is called so - // that the toolkit specific xpcom components can be registered - // as needed. - // - ////////////////////////////////////////////////////////////////////// - nsIUnixToolkitService * unixToolkitService = nsnull; - - nsresult rv = - nsComponentManager::CreateInstance(kCUnixToolkitServiceCID, - nsnull, - nsIUnixToolkitService::GetIID(), - (void **) &unixToolkitService); - - NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); - - if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService)) - { - // Force the toolkit into "motif" mode regardless of MOZ_TOOLKIT - unixToolkitService->SetToolkitName("motif"); - - NS_RELEASE(unixToolkitService); - } - - ////////////////////////////////////////////////////////////////////// - // End toolkit service setup - ////////////////////////////////////////////////////////////////////// + putenv("MOZ_TOOLKIT=motif"); gTheApp->Initialize(argc, argv); gTheApp->Run(); diff --git a/webshell/tests/viewer/unix/qt/nsQtMain.cpp b/webshell/tests/viewer/unix/qt/nsQtMain.cpp index 27565411ed07..57aeef751dc6 100644 --- a/webshell/tests/viewer/unix/qt/nsQtMain.cpp +++ b/webshell/tests/viewer/unix/qt/nsQtMain.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -25,11 +25,6 @@ #include #include "plevent.h" -#include "nsIUnixToolkitService.h" -#include "nsIComponentManager.h" - -static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID); - static nsNativeViewerApp* gTheApp; nsNativeViewerApp::nsNativeViewerApp() @@ -92,47 +87,18 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID) int main(int argc, char **argv) { - // Hack to get il_ss set so it doesn't fail in xpcompat.c - nsIImageManager *manager; - NS_NewImageManager(&manager); - - gTheApp = new nsNativeViewerApp(); - - ////////////////////////////////////////////////////////////////////// - // - // Toolkit Service setup - // - // Note: This must happend before NS_SetupRegistry() is called so - // that the toolkit specific xpcom components can be registered - // as needed. - // - ////////////////////////////////////////////////////////////////////// - nsIUnixToolkitService * unixToolkitService = nsnull; - - nsresult rv = - nsComponentManager::CreateInstance(kCUnixToolkitServiceCID, - nsnull, - nsIUnixToolkitService::GetIID(), - (void **) &unixToolkitService); + // Hack to get il_ss set so it doesn't fail in xpcompat.c + nsIImageManager *manager; + NS_NewImageManager(&manager); - NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); - - if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService)) - { - // Force the toolkit into "qt" mode regardless of MOZ_TOOLKIT - unixToolkitService->SetToolkitName("qt"); - - NS_RELEASE(unixToolkitService); - } - - ////////////////////////////////////////////////////////////////////// - // End toolkit service setup - ////////////////////////////////////////////////////////////////////// - - gTheApp->Initialize(argc, argv); - gTheApp->Run(); - - return 0; + gTheApp = new nsNativeViewerApp(); + + putenv("MOZ_TOOLKIT=qt"); + + gTheApp->Initialize(argc, argv); + gTheApp->Run(); + + return 0; } diff --git a/webshell/tests/viewer/unix/xlib/nsXlibMain.cpp b/webshell/tests/viewer/unix/xlib/nsXlibMain.cpp index 122c0defdf88..d675155507b7 100644 --- a/webshell/tests/viewer/unix/xlib/nsXlibMain.cpp +++ b/webshell/tests/viewer/unix/xlib/nsXlibMain.cpp @@ -19,11 +19,6 @@ #include "nsBrowserWindow.h" #include "nsViewerApp.h" -#include "nsIUnixToolkitService.h" -#include "nsIComponentManager.h" - -static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID); - nsNativeViewerApp::nsNativeViewerApp() { } @@ -71,36 +66,7 @@ int main (int argc, char **argv) nsViewerApp *app = new nsNativeViewerApp(); NS_ADDREF(app); - ////////////////////////////////////////////////////////////////////// - // - // Toolkit Service setup - // - // Note: This must happend before NS_SetupRegistry() is called so - // that the toolkit specific xpcom components can be registered - // as needed. - // - ////////////////////////////////////////////////////////////////////// - nsIUnixToolkitService * unixToolkitService = nsnull; - - nsresult rv = - nsComponentManager::CreateInstance(kCUnixToolkitServiceCID, - nsnull, - nsIUnixToolkitService::GetIID(), - (void **) &unixToolkitService); - - NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); - - if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService)) - { - // Force the toolkit into "xlib" mode - unixToolkitService->SetToolkitName("xlib"); - - NS_RELEASE(unixToolkitService); - } - - ////////////////////////////////////////////////////////////////////// - // End toolkit service setup - ////////////////////////////////////////////////////////////////////// + putenv("MOZ_TOOLKIT=xlib"); app->Initialize(argc, argv); app->Run();