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:
parent
ceee0a32a4
commit
190806e61f
@ -43,7 +43,6 @@
|
||||
#include "TermScrollView.h"
|
||||
#include "TermView.h"
|
||||
|
||||
|
||||
const static int32 kMaxTabs = 6;
|
||||
const static int32 kTermViewOffset = 3;
|
||||
|
||||
@ -232,20 +231,24 @@ 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;
|
||||
if (index != -1)
|
||||
isBusy = _TermViewAt(index)->IsShellBusy();
|
||||
else {
|
||||
for (int32 i = 0; i < fSessions.CountItems(); i++) {
|
||||
if (_TermViewAt(i)->IsShellBusy()) {
|
||||
isBusy = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBusy) {
|
||||
const char* alertMessage = B_TRANSLATE("A process is still running.\n"
|
||||
@ -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*>(
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user