Add tray icon theme settings to the settings dialog

This commit is contained in:
Jonas Schwabe
2016-05-08 01:01:56 +02:00
parent 5a201b7727
commit ecfa143526
3 changed files with 15 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ var SettingsPage = React.createClass({
teams: this.state.teams,
hideMenuBar: this.state.hideMenuBar,
showTrayIcon: this.state.showTrayIcon,
trayIconTheme: this.state.trayIconTheme,
disablewebsecurity: this.state.disablewebsecurity,
version: settings.version
};
@@ -69,6 +70,11 @@ var SettingsPage = React.createClass({
showTrayIcon: this.refs.showTrayIcon.getChecked()
});
},
handleChangeTrayIconTheme: function() {
this.setState({
trayIconTheme: this.refs.trayIconTheme.getValue()
});
},
render: function() {
var teams_row = (
<Row>
@@ -84,10 +90,16 @@ var SettingsPage = React.createClass({
options.push(<Input key="inputHideMenuBar" id="inputHideMenuBar" ref="hideMenuBar" type="checkbox" label="Hide Menu Bar (Press Alt to show Menu Bar)" checked={ this.state.hideMenuBar }
onChange={ this.handleChangeHideMenuBar } />);
}
if (process.platform === 'darwin') {
if (process.platform === 'darwin' || process.platform === 'linux') {
options.push(<Input key="inputShowTrayIcon" ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon }
/>);
}
if (process.platform === 'linux') {
options.push(<Input key="inputTrayIconTheme" ref="trayIconTheme" type="select" label="Icon theme (Need to restart the application)" value={ this.state.trayIconTheme } onChange={ this.handleChangeTrayIconTheme }>
<option value="light">Light</option>
<option value="dark">Dark</option>
</Input>);
}
options.push(<Input key="inputDisableWebSecurity" ref="disablewebsecurity" type="checkbox" label="Allow insecure contents (This allows not only insecure images, but also insecure scripts)"
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
var options_row = (options.length > 0) ? (

View File

@@ -24,6 +24,7 @@ var loadDefault = function(version) {
teams: [],
hideMenuBar: false,
showTrayIcon: false,
trayIconTheme: '',
disablewebsecurity: false,
version: 1
};

View File

@@ -64,7 +64,7 @@ const trayImages = function() {
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMentionTemplate.png'))
};
case 'linux':
var resourcesDir = 'resources/linux/' + (config.trayIconTheme||'light') + '/';
var resourcesDir = 'resources/linux/' + (config.trayIconTheme || 'light') + '/';
return {
normal: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconTemplate.png')),
unread: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconUnreadTemplate.png')),