1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Close tabs of Secondary Window on window close

Prior to this change, for secondary windows, documents were in an inconsistent state when
the window was closed. They also failed to re-open.
This commit is contained in:
Joseph Battelle 2021-02-01 23:44:06 -08:00
parent 1f772f685e
commit dab68d045a

View file

@ -1241,6 +1241,19 @@ namespace IDE
if (mRunningTestScript)
return true;
void CloseTabs()
{
WithDocumentTabbedViewsOf(window, scope (tabbedView) => {
tabbedView.CloseTabs(false, true);
});
}
void CloseWindow()
{
mMainWindow.SetForeground();
window.Close(true);
}
List<String> changedList = scope List<String>();
defer ClearAndDeleteItems(changedList);
WithSourceViewPanelsOf(window, scope (sourceViewPanel) =>
@ -1252,8 +1265,11 @@ namespace IDE
changedList.Add(fileName);
}
});
if (changedList.Count == 0)
if (changedList.Count == 0) {
CloseTabs();
return true;
}
var aDialog = QuerySaveFiles(changedList, (WidgetWindow)window);
aDialog.mDefaultButton = aDialog.AddButton("Save", new (evt) =>
{
@ -1268,8 +1284,8 @@ namespace IDE
});
if (hadError)
return;
mMainWindow.SetForeground();
window.Close(true);
CloseTabs();
CloseWindow();
});
aDialog.AddButton("Don't Save", new (evt) =>
{
@ -1279,8 +1295,8 @@ namespace IDE
if (sourceViewPanel.HasUnsavedChanges())
_this.RevertSourceViewPanel(sourceViewPanel);
});
mMainWindow.SetForeground();
window.Close(true);
CloseTabs();
CloseWindow();
});
aDialog.mEscButton = aDialog.AddButton("Cancel");