Also check if there are active process when closing a tab.

This completes the work needed to close ticket #3745


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39329 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2010-11-06 20:49:39 +00:00
parent ceee0a32a4
commit 190806e61f
2 changed files with 23 additions and 7 deletions

View File

@ -43,7 +43,6 @@
#include "TermScrollView.h"
#include "TermView.h"
const static int32 kMaxTabs = 6;
const static int32 kTermViewOffset = 3;
@ -232,18 +231,22 @@ TermWindow::_InitWindow()
bool
TermWindow::QuitRequested()
TermWindow::_CanClose(int32 index)
{
bool warnOnExit = PrefHandler::Default()->getBool(PREF_WARN_ON_EXIT);
if (!warnOnExit)
return BWindow::QuitRequested();
return true;
bool isBusy = false;
for (int32 i = 0; i < fSessions.CountItems(); i++) {
if (_TermViewAt(i)->IsShellBusy()) {
isBusy = true;
break;
if (index != -1)
isBusy = _TermViewAt(index)->IsShellBusy();
else {
for (int32 i = 0; i < fSessions.CountItems(); i++) {
if (_TermViewAt(i)->IsShellBusy()) {
isBusy = true;
break;
}
}
}
@ -258,6 +261,16 @@ TermWindow::QuitRequested()
return false;
}
return true;
}
bool
TermWindow::QuitRequested()
{
if (!_CanClose(-1))
return false;
BMessage position = BMessage(MSG_SAVE_WINDOW_POSITION);
position.AddRect("rect", Frame());
position.AddInt32("workspaces", Workspaces());
@ -900,6 +913,8 @@ void
TermWindow::_RemoveTab(int32 index)
{
if (fSessions.CountItems() > 1) {
if (!_CanClose(index))
return;
if (Session* session = (Session*)fSessions.RemoveItem(index)) {
if (fSessions.CountItems() == 1) {
fTabView->SetScrollView(dynamic_cast<BScrollView*>(

View File

@ -80,6 +80,7 @@ private:
void _DoPrint();
void _AddTab(Arguments *args);
void _RemoveTab(int32 index);
bool _CanClose(int32 index);
TermViewContainerView* _ActiveTermViewContainerView() const;
TermViewContainerView* _TermViewContainerViewAt(int32 index) const;
TermView* _ActiveTermView() const;