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