Move collation init so layout doesn't get called recursively - fix balsa orange

This commit is contained in:
enndeakin%sympatico.ca 2006-02-13 19:23:59 +00:00
Родитель be9aa23f63
Коммит 097bcbe7d0
2 изменённых файлов: 30 добавлений и 24 удалений

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

@ -142,26 +142,6 @@ nsXULContentUtils::Init()
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
// get a locale service
nsCOMPtr<nsILocaleService> localeService =
do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsILocale> locale;
rv = localeService->GetApplicationLocale(getter_AddRefs(locale));
if (NS_SUCCEEDED(rv) && locale) {
nsCOMPtr<nsICollationFactory> colFactory =
do_CreateInstance(kCollationFactoryCID);
if (colFactory) {
rv = colFactory->CreateCollation(locale, &gCollation);
NS_ASSERTION(NS_SUCCEEDED(rv),
"couldn't create collation instance");
} else
NS_ERROR("couldn't create instance of collation factory");
} else
NS_ERROR("unable to get application locale");
} else
NS_ERROR("couldn't get locale factory");
} }
return NS_OK; return NS_OK;
@ -187,6 +167,35 @@ nsXULContentUtils::Finish()
return NS_OK; return NS_OK;
} }
nsICollation*
nsXULContentUtils::GetCollation()
{
if (!gCollation) {
nsresult rv;
// get a locale service
nsCOMPtr<nsILocaleService> localeService =
do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsILocale> locale;
rv = localeService->GetApplicationLocale(getter_AddRefs(locale));
if (NS_SUCCEEDED(rv) && locale) {
nsCOMPtr<nsICollationFactory> colFactory =
do_CreateInstance(kCollationFactoryCID);
if (colFactory) {
rv = colFactory->CreateCollation(locale, &gCollation);
NS_ASSERTION(NS_SUCCEEDED(rv),
"couldn't create collation instance");
} else
NS_ERROR("couldn't create instance of collation factory");
} else
NS_ERROR("unable to get application locale");
} else
NS_ERROR("couldn't get locale factory");
}
return gCollation;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// nsIXULContentUtils methods // nsIXULContentUtils methods

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

@ -123,10 +123,7 @@ public:
} }
static nsICollation* static nsICollation*
GetCollation() GetCollation();
{
return gCollation;
}
#define XUL_RESOURCE(ident, uri) static nsIRDFResource* ident #define XUL_RESOURCE(ident, uri) static nsIRDFResource* ident
#define XUL_LITERAL(ident, val) static nsIRDFLiteral* ident #define XUL_LITERAL(ident, val) static nsIRDFLiteral* ident