mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 21:35:04 +02:00
Answering one shutdown popup closes them all
This commit is contained in:
parent
6cd6c3038f
commit
d159f8dc38
1 changed files with 31 additions and 28 deletions
|
@ -105,46 +105,49 @@ const ipcMain = electron.ipcMain;
|
||||||
var isShuttingDown = false;
|
var isShuttingDown = false;
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
if (!isShuttingDown) {
|
if (!isShuttingDown) {
|
||||||
var idx = 0;
|
|
||||||
|
|
||||||
// if the home server is running, show a prompt before quit to ask if the user is sure
|
// if the home server is running, show a prompt before quit to ask if the user is sure
|
||||||
if (homeServer.state == ProcessGroupStates.STARTED) {
|
if (homeServer.state == ProcessGroupStates.STARTED) {
|
||||||
idx = dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Yes', 'No'],
|
buttons: ['Yes', 'No'],
|
||||||
title: 'Are you sure?',
|
title: 'Are you sure?',
|
||||||
message: 'Quitting will stop your Server Console and your Home domain will no longer be running.'
|
message: 'Quitting will stop your Server Console and your Home domain will no longer be running.'
|
||||||
});
|
}, shutdownCallback);
|
||||||
|
} else {
|
||||||
|
shutdownCallback(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx == 0) {
|
}
|
||||||
isShuttingDown = true;
|
}
|
||||||
|
|
||||||
userConfig.save(configPath);
|
function shutdownCallback(idx) {
|
||||||
|
if (idx == 0 && !isShuttingDown) {
|
||||||
|
isShuttingDown = true;
|
||||||
|
|
||||||
if (logWindow) {
|
userConfig.save(configPath);
|
||||||
logWindow.close();
|
|
||||||
}
|
|
||||||
if (homeServer) {
|
|
||||||
homeServer.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTrayMenu(null);
|
if (logWindow) {
|
||||||
|
logWindow.close();
|
||||||
|
}
|
||||||
|
if (homeServer) {
|
||||||
|
homeServer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
if (homeServer.state == ProcessGroupStates.STOPPED) {
|
updateTrayMenu(null);
|
||||||
// if the home server is already down, take down the server console now
|
|
||||||
app.quit();
|
if (homeServer.state == ProcessGroupStates.STOPPED) {
|
||||||
} else {
|
// if the home server is already down, take down the server console now
|
||||||
// if the home server is still running, wait until we get a state change or timeout
|
app.quit();
|
||||||
// before quitting the app
|
} else {
|
||||||
var timeoutID = setTimeout(app.quit, 5000);
|
// if the home server is still running, wait until we get a state change or timeout
|
||||||
homeServer.on('state-update', function(processGroup) {
|
// before quitting the app
|
||||||
if (processGroup.state == ProcessGroupStates.STOPPED) {
|
var timeoutID = setTimeout(app.quit, 5000);
|
||||||
clearTimeout(timeoutID);
|
homeServer.on('state-update', function(processGroup) {
|
||||||
app.quit();
|
if (processGroup.state == ProcessGroupStates.STOPPED) {
|
||||||
}
|
clearTimeout(timeoutID);
|
||||||
});
|
app.quit();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue