Browse Source

Replace app.quit with app.exit.

We don't actually use any of the app.quit hooks,
this solves an additional problem with occasional
on-exit hangs with Windows as well.

Also included: tray menu finally uses locale.
pull/3202/head
TheGoddessInari 7 years ago
parent
commit
da64582cf3
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 10
      electron/main.js
  2. 12
      electron/menu.js
  3. 11
      electron/tray.js
  4. 2
      masterpassword.html

10
electron/main.js

@ -187,7 +187,7 @@ function createWindow () {
mainWindow.minimize();
break;
case 'quit':
app.quit();
app.exit();
break;
}
break;
@ -324,15 +324,15 @@ const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
});
if (shouldQuit) {
app.quit();
app.exit();
}
// Code for downloading images as temporal files
// Credit: Ghetto Skype (https://github.com/stanfieldr/ghetto-skype)
const tmp = require('tmp');
const mime = require('mime');
var imageCache = {};
ipcMain.on('image:download', function(event, url, partition) {
const tmp = require('tmp');
const mime = require('mime');
let file = imageCache[url];
if (file) {
if (file.complete) {
@ -449,7 +449,7 @@ app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
app.exit();
}
});

12
electron/menu.js

@ -258,8 +258,10 @@ module.exports = function(config) {
type: 'separator'
},
{
role: 'quit',
label: locale['tray[1]']
label: locale['tray[1]'],
click() {
app.exit();
}
}
]
});
@ -277,8 +279,10 @@ module.exports = function(config) {
type: 'separator'
},
{
role: 'quit',
label: locale['menu.file[1]']
label: locale['menu.file[1]'],
click() {
app.exit();
}
}
]
});

11
electron/tray.js

@ -10,13 +10,14 @@ var appIcon = null;
exports.create = function(win, config) {
if (process.platform === 'darwin' || appIcon || config.get('window_display_behavior') === 'show_taskbar' ) return;
const locale = require('../resources/languages/'+config.get('locale'));
const icon = process.platform === 'linux' || process.platform === 'darwin' ? 'IconTray.png' : 'Icon.ico';
const iconPath = path.join(__dirname, `../resources/${icon}`);
const contextMenu = electron.Menu.buildFromTemplate([
{
label: 'Show/Hide Window'
,click() {
label: locale['tray[0]'],
click() {
win.webContents.executeJavaScript('ipc.send("toggleWin", false);');
}
},
@ -24,9 +25,9 @@ exports.create = function(win, config) {
type: 'separator'
},
{
label: 'Quit'
,click() {
app.quit();
label: locale['tray[1]'],
click() {
app.exit();
}
}
]);

2
masterpassword.html

@ -25,7 +25,7 @@
return doValidate({ keyCode: 13 }, document.getElementsByTagName('input')[0].value);
}
function exit() {
require('electron').remote.app.quit();
require('electron').remote.app.exit();
}
</script>
</body>

Loading…
Cancel
Save