Reimplement e129755d properly.

Before this commit, quitting through menu would bring up the dialog
twice when declining to save the file.
pull/10/head
whitequark 2016-05-20 21:48:10 +00:00
parent 9c08398f51
commit ddc0dd7194
3 changed files with 4 additions and 5 deletions

View File

@ -1176,8 +1176,6 @@ const void *SolveSpace::LoadResource(const std::string &name, size_t *size) {
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
SolveSpace::SK.Clear();
SolveSpace::SS.Clear();
SolveSpace::SS.Exit();
}
@ -1211,5 +1209,8 @@ int main(int argc, const char *argv[]) {
[NSApp activateIgnoringOtherApps:YES];
[NSApp run];
SolveSpace::SK.Clear();
SolveSpace::SS.Clear();
return 0;
}

View File

@ -642,6 +642,7 @@ protected:
}
bool on_delete_event(GdkEventAny *) override {
if(!SS.OkayToStartNewFile()) return true;
SS.Exit();
return true;

View File

@ -147,9 +147,6 @@ bool SolveSpaceUI::OpenFile(const std::string &filename) {
}
void SolveSpaceUI::Exit() {
if(!OkayToStartNewFile())
return;
// Recent files
for(int i = 0; i < MAX_RECENT; i++)
CnfFreezeString(RecentFile[i], "RecentFile_" + std::to_string(i));