TermView constructor throws an exception if initializing the object failed.
TermWindow catches the exception, and quits the application in that case. Fixed weird wrapping of the text in the about window. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34530 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -178,7 +178,9 @@ TermView::TermView(BRect frame, int32 argc, const char** argv, int32 historySize
|
||||
fReportButtonMouseEvent(false),
|
||||
fReportAnyMouseEvent(false)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
status_t status = _InitObject(argc, argv);
|
||||
if (status != B_OK)
|
||||
throw status;
|
||||
SetTermSize(frame);
|
||||
}
|
||||
|
||||
@@ -197,7 +199,9 @@ TermView::TermView(int rows, int columns, int32 argc, const char** argv,
|
||||
fReportButtonMouseEvent(false),
|
||||
fReportAnyMouseEvent(false)
|
||||
{
|
||||
_InitObject(argc, argv);
|
||||
status_t status = _InitObject(argc, argv);
|
||||
if (status != B_OK)
|
||||
throw status;
|
||||
|
||||
// TODO: Don't show the dragger, since replicant capabilities
|
||||
// don't work very well ATM.
|
||||
@@ -247,8 +251,10 @@ TermView::TermView(BMessage* archive)
|
||||
}
|
||||
|
||||
// TODO: Retrieve colors, history size, etc. from archive
|
||||
_InitObject(argc, argv);
|
||||
|
||||
status_t status = _InitObject(argc, argv);
|
||||
if (status != B_OK)
|
||||
throw status;
|
||||
|
||||
bool useRect = false;
|
||||
if ((archive->FindBool("use_rect", &useRect) == B_OK) && useRect)
|
||||
SetTermSize(frame);
|
||||
@@ -2710,10 +2716,10 @@ void
|
||||
TermView::AboutRequested()
|
||||
{
|
||||
BAlert *alert = new (std::nothrow) BAlert("about",
|
||||
"Terminal\n"
|
||||
"\twritten by Kazuho Okui and Takashi Murai\n"
|
||||
"\tupdated by Kian Duffy and others\n\n"
|
||||
"\tCopyright " B_UTF8_COPYRIGHT "2003-2009, Haiku.\n", "Ok");
|
||||
"Terminal\n\n"
|
||||
"written by Kazuho Okui and Takashi Murai\n"
|
||||
"updated by Kian Duffy and others\n\n"
|
||||
"Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku.\n", "Ok");
|
||||
if (alert != NULL)
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
@@ -833,6 +833,12 @@ TermWindow::_AddTab(Arguments *args)
|
||||
} catch (...) {
|
||||
// most probably out of memory. That's bad.
|
||||
// TODO: Should cleanup, I guess
|
||||
|
||||
// Quit the application if we don't have a shell already
|
||||
if (fTabView->CountTabs() == 0) {
|
||||
fprintf(stderr, "Terminal couldn't open a shell\n");
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,14 +1033,14 @@ void
|
||||
CustomTermView::NotifyQuit(int32 reason)
|
||||
{
|
||||
BWindow *window = Window();
|
||||
if (window == NULL)
|
||||
window = be_app->WindowAt(0);
|
||||
|
||||
// TODO: If we got this from a view in a tab not currently selected,
|
||||
// Window() will be NULL, as the view is detached.
|
||||
// So we send the message to the first application window
|
||||
// This isn't so cool, but for now, a Terminal app has only one
|
||||
// window.
|
||||
// This isn't so cool, but should be safe, since a Terminal
|
||||
// application has only one window, at least for now.
|
||||
if (window == NULL)
|
||||
window = be_app->WindowAt(0);
|
||||
|
||||
if (window != NULL) {
|
||||
BMessage message(kCloseView);
|
||||
message.AddPointer("termView", this);
|
||||
|
||||
Reference in New Issue
Block a user