From ae96ed6dbe5a87fc378d5a104927c75abc384701 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Sat, 31 Aug 2013 15:57:25 -0400 Subject: [PATCH] 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. --- src/apps/mediaconverter/MediaFileInfoView.cpp | 12 ++++++------ src/apps/mediaplayer/MainWin.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apps/mediaconverter/MediaFileInfoView.cpp b/src/apps/mediaconverter/MediaFileInfoView.cpp index 0aa2de7277..aa84411089 100644 --- a/src/apps/mediaconverter/MediaFileInfoView.cpp +++ b/src/apps/mediaconverter/MediaFileInfoView.cpp @@ -157,20 +157,20 @@ MediaFileInfoView::Update(BMediaFile* file, entry_ref* ref) if (file != NULL && ref != NULL) { fRef = *ref; - status_t ret = fInfo.LoadInfo(file); - if (ret != B_OK) { + status_t result = fInfo.LoadInfo(file); + if (result != B_OK) { BString error(B_TRANSLATE("An error has occurred reading the " "file info.\n\nError : ")); - error << strerror(ret); + error << strerror(result); BAlert* alert = new BAlert( 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->Go(NULL); } - } else { + } else fRef = entry_ref(); - } + InvalidateLayout(); Invalidate(); } diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index f10524099f..1a43cb1d26 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -1092,7 +1092,7 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item) "The file could not be opened."); message.ReplaceFirst("%app%", kApplicationName); 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->Go(); _PlaylistItemOpened(item, ret); @@ -1341,7 +1341,7 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result) message << B_TRANSLATE("Error: ") << strerror(result); } 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->Go(); fControls->SetDisabledString(kDisabledSeekMessage);