mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:50:43 +02:00
Add prompt dialog before shutting down
This commit is contained in:
parent
8a4855c411
commit
ef7d60687b
1 changed files with 19 additions and 12 deletions
|
@ -4,7 +4,7 @@ var electron = require('electron');
|
|||
var app = electron.app; // Module to control application life.
|
||||
var BrowserWindow = electron.BrowserWindow;
|
||||
|
||||
|
||||
var dialog = electron.dialog;
|
||||
var Menu = require('menu');
|
||||
var Tray = require('tray');
|
||||
var shell = require('shell');
|
||||
|
@ -44,6 +44,12 @@ const osType = os.type();
|
|||
var isShuttingDown = false;
|
||||
function shutdown() {
|
||||
if (!isShuttingDown) {
|
||||
var idx = dialog.showMessageBox({
|
||||
type: 'question',
|
||||
buttons: ['Yes', 'No'],
|
||||
message: 'Are you sure you want to quit?'
|
||||
});
|
||||
if (idx == 0) {
|
||||
isShuttingDown = true;
|
||||
logWindow.close();
|
||||
homeServer.stop();
|
||||
|
@ -59,6 +65,7 @@ function shutdown() {
|
|||
updateTrayMenu(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var logPath = path.join(getApplicationDataDirectory(), '/logs');
|
||||
|
|
Loading…
Reference in a new issue