Bug 88630 - Themes and locales do not change when using turbo. r=vishy/sr=blake

This commit is contained in:
ccarlen%netscape.com 2001-07-10 08:01:55 +00:00
parent 0294653201
commit 815ed97616
6 changed files with 25 additions and 7 deletions

View File

@ -80,11 +80,10 @@
if (newContentPack && (newContentPack != oldContentPack))
{
try {
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if ( chromeRegistry ) {
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
}
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
chromeRegistry.selectLocale(newContentPack, true);
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.Notify(null, "locale-selected", null);
var contentBundle = document.getElementById("bundle_contentPack");
var brandBundle = document.getElementById("bundle_brand");
var alertText = contentBundle.getString("contentAlert");

View File

@ -71,6 +71,9 @@ static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID);
static char *gEQActivatedNotification = "nsIEventQueueActivated";
static char *gEQDestroyedNotification = "nsIEventQueueDestroyed";
NS_NAMED_LITERAL_STRING(gSkinSelectedTopic, "skin-selected");
NS_NAMED_LITERAL_STRING(gLocaleSelectedTopic, "locale-selected");
nsAppShellService::nsAppShellService() :
mAppShell( nsnull ),
mWindowList( nsnull ),
@ -873,6 +876,10 @@ NS_IMETHODIMP nsAppShellService::Observe(nsISupports *aSubject,
if (isNative)
mAppShell->ListenToEventQueue(eq, PR_FALSE);
}
} else if (topic.Equals(gSkinSelectedTopic) ||
topic.Equals(gLocaleSelectedTopic)) {
if (mNativeAppSupport)
mNativeAppSupport->SetIsServerMode(PR_FALSE);
}
return NS_OK;
}
@ -898,9 +905,13 @@ void nsAppShellService::RegisterObserver(PRBool aRegister)
if (aRegister) {
os->AddObserver(weObserve, topicA.get());
os->AddObserver(weObserve, topicB.get());
os->AddObserver(weObserve, gSkinSelectedTopic.get());
os->AddObserver(weObserve, gLocaleSelectedTopic.get());
} else {
os->RemoveObserver(weObserve, topicA.get());
os->RemoveObserver(weObserve, topicB.get());
os->RemoveObserver(weObserve, gSkinSelectedTopic.get());
os->RemoveObserver(weObserve, gLocaleSelectedTopic.get());
}
nsServiceManager::ReleaseService(NS_OBSERVERSERVICE_CONTRACTID, glop);
}

View File

@ -1297,6 +1297,9 @@ function applyTheme(themeName)
// hacking around it yet again
pref.SetUnicharPref("general.skins.selectedSkin", themeName.getAttribute("name"));
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.Notify(null, "skin-selected", null);
if (promptService) {
var dialogTitle = gNavigatorBundle.getString("switchskinstitle");
var brandName = gBrandBundle.getString("brandShortName");

View File

@ -65,10 +65,10 @@
if (newLangCode != oldLangCode) {
try {
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
if ( chromeRegistry )
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
chromeRegistry.selectLocale(newLangCode, true);
observerService.Notify(null, "locale-selected", null);
}
catch(e) {
return false;

View File

@ -39,6 +39,9 @@ function applySkin()
kPrefSvc.SetUnicharPref("general.skins.selectedSkin", skinName);
tree.selectItem(selectedSkinItem);
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.Notify(null, "skin-selected", null);
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
try {
var strbundle = srGetStrBundle("chrome://navigator/locale/navigator.properties");

View File

@ -32,6 +32,8 @@ function selectLocale(event)
{
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Components.interfaces.nsIChromeRegistry);
chromeRegistry.selectLocale(langcode, true);
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.Notify(null, "locale-selected", null);
var prefUtilBundle = srGetStrBundle("chrome://communicator/locale/pref/prefutilities.properties");
var brandBundle = srGetStrBundle("chrome://global/locale/brand.properties");
var alertText = prefUtilBundle.GetStringFromName("languageAlert");