Makes the check for the tray icon a bit more lightweight

This commit is contained in:
Martin Gondermann
2016-07-03 23:04:36 +02:00
parent 3c0c448502
commit 04cbec9a5d
2 changed files with 8 additions and 11 deletions

View File

@@ -50,15 +50,9 @@ var SettingsPage = React.createClass({
if (process.platform === 'darwin') {
var currentWindow = remote.getCurrentWindow();
if (currentWindow.tray) {
this.setState({
trayWasVisible: true
});
} else {
this.setState({
trayWasVisible: false
});
}
this.setState({
trayWasVisible: currentWindow.trayWasVisible
});
}
},
handleTeamsChange: function(teams) {

View File

@@ -359,9 +359,12 @@ app.on('ready', function() {
const tray_menu = require('./main/menus/tray').createDefault(mainWindow);
trayIcon.setContextMenu(tray_menu);
if (process.platform === 'darwin') {
// store a reference to the tray icon, for checking in the settings, if the application
// store the information, if the tray was initialized, for checking in the settings, if the application
// was restarted after setting "Show icon on menu bar"
mainWindow.tray = trayIcon;
if (trayIcon)
mainWindow.trayWasVisible = true;
else
mainWindow.trayWasVisible = false;
}
}