Use a stop alert when you can't open the file.

This is a fatal error that the user has no way to recover from
so using the info alert is not appropriate here.

Also rename the ret variable to result and omit extraneous braces.
This commit is contained in:
John Scipione 2013-08-31 15:57:25 -04:00
parent 72d0921ae8
commit ae96ed6dbe
2 changed files with 8 additions and 8 deletions

View File

@ -157,20 +157,20 @@ MediaFileInfoView::Update(BMediaFile* file, entry_ref* ref)
if (file != NULL && ref != NULL) { if (file != NULL && ref != NULL) {
fRef = *ref; fRef = *ref;
status_t ret = fInfo.LoadInfo(file); status_t result = fInfo.LoadInfo(file);
if (ret != B_OK) { if (result != B_OK) {
BString error(B_TRANSLATE("An error has occurred reading the " BString error(B_TRANSLATE("An error has occurred reading the "
"file info.\n\nError : ")); "file info.\n\nError : "));
error << strerror(ret); error << strerror(result);
BAlert* alert = new BAlert( BAlert* alert = new BAlert(
B_TRANSLATE("File Error"), error.String(), B_TRANSLATE("File Error"), error.String(),
B_TRANSLATE("OK")); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL); alert->Go(NULL);
} }
} else { } else
fRef = entry_ref(); fRef = entry_ref();
}
InvalidateLayout(); InvalidateLayout();
Invalidate(); Invalidate();
} }

View File

@ -1092,7 +1092,7 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item)
"The file could not be opened."); "The file could not be opened.");
message.ReplaceFirst("%app%", kApplicationName); message.ReplaceFirst("%app%", kApplicationName);
BAlert* alert = new BAlert(kApplicationName, message.String(), BAlert* alert = new BAlert(kApplicationName, message.String(),
B_TRANSLATE("OK")); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(); alert->Go();
_PlaylistItemOpened(item, ret); _PlaylistItemOpened(item, ret);
@ -1341,7 +1341,7 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result)
message << B_TRANSLATE("Error: ") << strerror(result); message << B_TRANSLATE("Error: ") << strerror(result);
} }
BAlert* alert = new BAlert("error", message.String(), BAlert* alert = new BAlert("error", message.String(),
B_TRANSLATE("OK")); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(); alert->Go();
fControls->SetDisabledString(kDisabledSeekMessage); fControls->SetDisabledString(kDisabledSeekMessage);