Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36699 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia 2010-05-07 00:43:51 +00:00
parent 913ffd3e69
commit 4ef6cf5d0e
1 changed files with 40 additions and 37 deletions

View File

@ -35,11 +35,11 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
_BuildProfilesMenu(profilesPopup, SELECT_PROFILE_MSG);
BMenuField *profilesMenuField = new BMenuField("profiles_menu",
TR("Profile:"), profilesPopup);
B_TRANSLATE("Profile:"), profilesPopup);
profilesMenuField->SetFont(be_bold_font);
BButton *button = new BButton("manage_profiles",
TR("Manage profiles" B_UTF8_ELLIPSIS),
B_TRANSLATE("Manage profiles" B_UTF8_ELLIPSIS),
new BMessage(MANAGE_PROFILES_MSG));
// ---- Settings section
@ -50,14 +50,15 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
BBox *bottomDivider = new BBox(B_EMPTY_STRING);
bottomDivider->SetBorder(B_PLAIN_BORDER);
BCheckBox *dontTouchCheckBox = new BCheckBox("dont_touch",
TR("Prevent unwanted changes"), new BMessage(DONT_TOUCH_MSG));
BCheckBox *dontTouchCheckBox = new BCheckBox("dont_touch",
B_TRANSLATE("Prevent unwanted changes"),
new BMessage(DONT_TOUCH_MSG));
dontTouchCheckBox->SetValue(B_CONTROL_ON);
fApplyNowButton = new BButton("apply_now", TR("Apply Now"),
fApplyNowButton = new BButton("apply_now", B_TRANSLATE("Apply Now"),
new BMessage(APPLY_NOW_MSG));
fRevertButton = new BButton("revert", TR("Revert"),
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(REVERT_MSG));
fRevertButton->SetEnabled(false);
@ -88,12 +89,12 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
fMinAddonViewRect.Height()));
fAddonView = NULL;
}
@ -117,20 +118,20 @@ NetworkSetupWindow::MessageReceived(BMessage* msg)
case NEW_PROFILE_MSG:
break;
case DELETE_PROFILE_MSG: {
break;
}
case SELECT_PROFILE_MSG: {
BPath name;
const char *path;
bool is_default;
bool is_current;
if (msg->FindString("path", &path) != B_OK)
break;
name.SetTo(path);
is_default = (strcmp(name.Leaf(), "default") == 0);
@ -139,17 +140,17 @@ NetworkSetupWindow::MessageReceived(BMessage* msg)
fApplyNowButton->SetEnabled(!is_current);
break;
}
case SHOW_MSG: {
if (fAddonView)
fAddonView->RemoveSelf();
fAddonView = NULL;
if (msg->FindPointer("addon_view", (void **) &fAddonView) != B_OK)
break;
fPanel->AddChild(fAddonView);
fAddonView->ResizeTo(fPanel->Bounds().Width(),
fAddonView->ResizeTo(fPanel->Bounds().Width(),
fPanel->Bounds().Height());
break;
}
@ -165,7 +166,7 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
{
BMenuItem* item;
char current_profile[256] = { 0 };
menu->SetRadioMode(true);
BDirectory dir("/boot/common/settings/network/profiles");
@ -182,13 +183,13 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
if (entry.IsSymLink() &&
strcmp("current", name.Leaf()) == 0) {
BSymLink symlink(&entry);
if (symlink.IsAbsolute())
// oh oh, sorry, wrong symlink...
continue;
symlink.ReadLink(current_profile, sizeof(current_profile));
continue;
continue;
};
if (!entry.IsDirectory())
@ -196,15 +197,17 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
msg = new BMessage(msg_what);
msg->AddString("path", name.Path());
item = new BMenuItem(name.Leaf(), msg);
menu->AddItem(item);
}
}
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("New" B_UTF8_ELLIPSIS), new BMessage(NEW_PROFILE_MSG)));
menu->AddItem(new BMenuItem(TR("Delete"), new BMessage(DELETE_PROFILE_MSG)));
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
new BMessage(NEW_PROFILE_MSG)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Delete"),
new BMessage(DELETE_PROFILE_MSG)));
if (strlen(current_profile)) {
item = menu->FindItem(current_profile);
@ -232,14 +235,14 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
return;
fMinAddonViewRect.Set(0, 0, 200, 200); // Minimum size
search_paths = strdup(search_paths);
search_paths = strdup(search_paths);
char* next_path_token;
char* search_path = strtok_r(search_paths, ":", &next_path_token);
while (search_path) {
if (strncmp(search_path, "%A/", 3) == 0) {
app_info ai;
app_info ai;
be_app->GetAppInfo(&ai);
entry.SetTo(&ai.ref);
entry.GetPath(&path);
@ -251,11 +254,11 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
}
search_path = strtok_r(NULL, ":", &next_path_token);
dir.SetTo(path.Path());
if (dir.InitCheck() != B_OK)
continue;
dir.Rewind();
while (dir.GetNextEntry(&entry) >= 0) {
if (entry.IsDirectory())
@ -264,30 +267,30 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
entry.GetPath(&addon_path);
image_id addon_id = load_add_on(addon_path.Path());
if (addon_id < 0) {
printf("Failed to load %s addon: %s.\n", addon_path.Path(),
printf("Failed to load %s addon: %s.\n", addon_path.Path(),
strerror(addon_id));
continue;
}
network_setup_addon_instantiate get_nth_addon;
status_t status = get_image_symbol(addon_id, "get_nth_addon",
status_t status = get_image_symbol(addon_id, "get_nth_addon",
B_SYMBOL_TYPE_TEXT, (void **) &get_nth_addon);
if (status == B_OK) {
NetworkSetupAddOn *addon;
int n = 0;
while ((addon = get_nth_addon(addon_id, n)) != NULL) {
BMessage* msg = new BMessage(msg_what);
BRect r(0, 0, 0, 0);
BView* addon_view = addon->CreateView(&r);
fMinAddonViewRect = fMinAddonViewRect | r;
msg->AddInt32("image_id", addon_id);
msg->AddString("addon_path", addon_path.Path());
msg->AddPointer("addon", addon);
msg->AddPointer("addon_view", addon_view);
BTab *tab = new BTab;
fPanel->AddTab(addon_view,tab);
tab->SetLabel(addon->Name());
@ -304,4 +307,4 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
}
free(search_paths);
}
}