From 89e3a52ef232b78593419fa605f988fe2f2af21d Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Sat, 10 Dec 2016 20:32:04 +0100 Subject: [PATCH 1/2] Add a fallback when the notification icon theme is not valid - the app did not start up successfully before --- src/main.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.js b/src/main.js index eef0b6d6dd2..283aca7e56f 100644 --- a/src/main.js +++ b/src/main.js @@ -153,12 +153,21 @@ const trayImages = (() => { } case 'linux': { - const theme = config.trayIconTheme || 'light'; - return { - normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')), - unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')), - mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png')) - }; + const theme = config.trayIconTheme; + try { + return { + normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')), + unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')), + mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png')) + }; + } catch (e) { + //Fallback for invalid theme setting + return { + normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.png')), + unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconUnreadTemplate.png')), + mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconMentionTemplate.png')) + }; + } } default: return {}; From d4f3ca23d3f0ada5d6ef70b26adf1b0bb5ec3d39 Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Sat, 10 Dec 2016 20:27:09 +0100 Subject: [PATCH 2/2] Fixes a bug on the settings pane which rendered the notification theme icon as a checkbox --- src/browser/components/SettingsPage.jsx | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/browser/components/SettingsPage.jsx b/src/browser/components/SettingsPage.jsx index 08f3e34135e..c4509dfa960 100644 --- a/src/browser/components/SettingsPage.jsx +++ b/src/browser/components/SettingsPage.jsx @@ -1,5 +1,6 @@ const React = require('react'); -const {Button, Checkbox, Col, FormGroup, Grid, Navbar, Row} = require('react-bootstrap'); +const ReactDOM = require('react-dom'); +const {Button, Checkbox, Col, FormGroup, FormControl, ControlLabel, Grid, Navbar, Row} = require('react-bootstrap'); const {ipcRenderer, remote} = require('electron'); const AutoLaunch = require('auto-launch'); @@ -114,7 +115,7 @@ const SettingsPage = React.createClass({ }, handleChangeTrayIconTheme() { this.setState({ - trayIconTheme: !this.refs.trayIconTheme.props.checked + trayIconTheme: ReactDOM.findDOMNode(this.refs.trayIconTheme).value }); }, handleChangeAutoStart() { @@ -189,16 +190,19 @@ const SettingsPage = React.createClass({ } if (process.platform === 'linux') { options.push( - {'Icon theme (Need to restart the application)'} - - - ); + + {'Icon theme (Need to restart the application)'} + + + + + ); } options.push(