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