* ReadOnlyBootPrompt finally saves the locale settings again, so at first bot the system will be in the right language.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37863 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-03 09:08:52 +00:00
parent 5dbb457c09
commit a09c2bb328
2 changed files with 7 additions and 27 deletions

View File

@ -177,51 +177,31 @@ BootPromptWindow::MessageReceived(BMessage* message)
}
}
namespace BPrivate {
void ForceUnloadCatalog();
};
void
BootPromptWindow::_InitCatalog(bool saveSettings)
{
// Initilialize the Locale Kit
BPrivate::ForceUnloadCatalog();
// Generate a settings file
// TODO: This should not be necessary.
// be_locale_roster->SetPreferredLanguages() should take care of things
if (!saveSettings)
return;
/*
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK
|| path.Append("Locale settings") != B_OK) {
return;
}
BMessage settings;
BFile file;
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK)
settings.Unflatten(&file);
BString language;
if (fCatalog->GetLanguage(&language) == B_OK) {
settings.RemoveName("language");
if (be_locale_roster->GetCatalog()->GetLanguage(&language) == B_OK) {
settings.AddString("language", language.String());
}
settings.RemoveName("country");
BCountry country(language.String(), language.ToUpper());
settings.AddString("country", country.Code());
mutable_locale_roster->SetPreferredLanguages(&settings);
if (file.SetTo(path.Path(), B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY)
!= B_OK
|| settings.Flatten(&file) != B_OK) {
fprintf(stderr, "Failed to write Local Kit settings!\n");
}
*/
BCountry country(language.String(), language.ToUpper());
mutable_locale_roster->SetDefaultCountry(country);
}

View File

@ -102,7 +102,7 @@ BCatalog::SetCatalog(const char* signature, uint32 fingerprint)
{
// This is not thread safe. It is used only in ReadOnlyBootPrompt and should
// not do harm there, but not sure what to do about it…
delete fCatalog;
mutable_locale_roster->UnloadCatalog(fCatalog);
fCatalog = mutable_locale_roster->LoadCatalog(signature, NULL, fingerprint);
return B_OK;