Merge pull request #261 from St-Ex/settings-from-tray

Add access to settings through tray menu
This commit is contained in:
Yuya Ochiai 2016-08-26 01:10:14 +09:00 committed by GitHub
commit d3ddef21ba
4 changed files with 16 additions and 6 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ npm-debug.log
test-results.xml test-results.xml
test_config.json test_config.json
.idea

View file

@ -16,6 +16,7 @@ Release date: TBD
- Invalidate cache before load, to make server upgrades easy - Invalidate cache before load, to make server upgrades easy
- Removed misleading shortcuts from tray menu, as they didn't work - Removed misleading shortcuts from tray menu, as they didn't work
- Ctrl/Command+F puts cursor in search box to search in current channel. - Ctrl/Command+F puts cursor in search box to search in current channel.
- Add access to settings through tray menu
#### Windows #### Windows
- Added an option to toogle the red dot icon for unread messages (default is on). - Added an option to toogle the red dot icon for unread messages (default is on).

View file

@ -78,6 +78,7 @@ You have to configure the application to interact with your teams.
- Windows: Press `Alt` key to bring up the menu at the top of the window, then click `File -> Settings`. - Windows: Press `Alt` key to bring up the menu at the top of the window, then click `File -> Settings`.
- OS X: Click `Mattermost` from the menu at the top of the screen, then click `Preferences...`. - OS X: Click `Mattermost` from the menu at the top of the screen, then click `Preferences...`.
- Linux: Click `File -> Settings` on the menu. - Linux: Click `File -> Settings` on the menu.
- All : right-click on tray icon and click `Settings`
2. Press `+` button next to the "Teams" label. 2. Press `+` button next to the "Teams" label.

View file

@ -12,12 +12,7 @@ function createTemplate(mainWindow, config) {
return { return {
label: team.name, label: team.name,
click: (item, focusedWindow) => { click: (item, focusedWindow) => {
if (mainWindow.isMinimized()) { showOrRestore(mainWindow);
mainWindow.restore();
}
else {
mainWindow.show();
}
mainWindow.webContents.send('switch-tab', i); mainWindow.webContents.send('switch-tab', i);
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
@ -28,6 +23,14 @@ function createTemplate(mainWindow, config) {
}; };
}), { }), {
type: 'separator' type: 'separator'
}, {
label: 'Settings',
click: () => {
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
showOrRestore(mainWindow);
}
}, {
type: 'separator'
}, { }, {
role: 'quit' role: 'quit'
} }
@ -39,6 +42,10 @@ var createMenu = function(mainWindow, config) {
return Menu.buildFromTemplate(createTemplate(mainWindow, config)); return Menu.buildFromTemplate(createTemplate(mainWindow, config));
}; };
function showOrRestore(window) {
window.isMinimized() ? window.restore() : window.show()
}
module.exports = { module.exports = {
createMenu: createMenu createMenu: createMenu
}; };