From 7bbc87b3d0ae3fa78dea0ef6dc00497984a50e37 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Tue, 16 Mar 1999 07:25:43 +0000 Subject: [PATCH] fix for bug #2343 - Preferences are not initialized in the apprunner... git-svn-id: svn://10.0.0.236/trunk@24206 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/appshell/src/makefile.win | 1 + .../xpfe/appshell/src/nsWebShellWindow.cpp | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mozilla/xpfe/appshell/src/makefile.win b/mozilla/xpfe/appshell/src/makefile.win index 21e70446a80..ccc7a31c678 100644 --- a/mozilla/xpfe/appshell/src/makefile.win +++ b/mozilla/xpfe/appshell/src/makefile.win @@ -44,6 +44,7 @@ LINCS=-I$(PUBLIC)\raptor \ -I$(PUBLIC)\base \ -I$(PUBLIC)\dom \ -I$(PUBLIC)\js \ + -I$(PUBLIC)\pref \ -I$(PUBLIC)\appcores \ -I$(PUBLIC)\netlib diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index e68eb795815..3059e8c9634 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -23,6 +23,7 @@ #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsIURL.h" +#include "nsIPref.h" #include "nsGUIEvent.h" #include "nsWidgetsCID.h" @@ -73,6 +74,9 @@ static NS_DEFINE_IID(kMenuBarCID, NS_MENUBAR_CID); static NS_DEFINE_IID(kMenuCID, NS_MENU_CID); static NS_DEFINE_IID(kMenuItemCID, NS_MENUITEM_CID); +static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); + + /* Define Interface IDs */ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIWebShellWindowIID, NS_IWEBSHELL_WINDOW_IID); @@ -233,7 +237,23 @@ nsresult nsWebShellWindow::Initialize(nsIWidget* aParent, if (nsnull != docLoader) { docLoader->AddObserver((nsIDocumentLoaderObserver *)this); } -/// webShell->SetPrefs(aPrefs); + + /* + * XXX: How should preferences be supplied to the nsWebShellWindow? + * Should there be the notion of a global preferences service? + * Or should there be many preferences components based on + * the user profile... + */ + // Initialize the webshell with the preferences service + nsIPref *prefs; + + rv = nsServiceManager::GetService(kPrefCID, + nsIPref::GetIID(), + (nsISupports **)&prefs); + if (NS_SUCCEEDED(rv)) { + mWebShell->SetPrefs(prefs); + nsServiceManager::ReleaseService(kPrefCID, prefs); + } NS_IF_RELEASE(mCallbacks); mCallbacks = aCallbacks;