No longer ignores a failing SetMode() but will show an error request.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14936 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-15 10:35:59 +00:00
parent 60bddfface
commit 07184a9e61
1 changed files with 28 additions and 4 deletions

View File

@ -128,6 +128,20 @@ refresh_rate_to_string(float refresh, BString &string,
}
static const char*
screen_errors(status_t status)
{
switch (status) {
case B_ENTRY_NOT_FOUND:
return "Unknown Mode";
// TODO: add more?
default:
return strerror(status);
}
}
// #pragma mark -
@ -921,10 +935,20 @@ ScreenWindow::Apply()
return;
}
if (fScreenMode.Set(fSelected) == B_OK)
status_t status = fScreenMode.Set(fSelected);
if (status == B_OK) {
fActive = fSelected;
// ToDo: only show alert when this is an unknown mode
BWindow *window = new AlertWindow(this);
window->Show();
// ToDo: only show alert when this is an unknown mode
BWindow* window = new AlertWindow(this);
window->Show();
} else {
char message[256];
snprintf(message, sizeof(message),
"The screen mode could not be set:\n\t%s\n", screen_errors(status));
BAlert* alert = new BAlert("Screen Alert", message, "Okay", NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go();
}
}