Electron: Use default labels and accelerators

Less code for us to maintain.

This also gives us free internationalization in a future Electron
version (they'll set the label dynamically based on the 'role')

One slight regression with this change, but it will be fixed in a
future Electron once this PR is merged:
https://github.com/electron/electron/pull/6600
This commit is contained in:
Feross Aboukhadijeh
2016-07-25 15:21:46 -07:00
parent 2eb33e5f0c
commit 5796ba32a6

View File

@@ -99,10 +99,6 @@ function getMenuTemplate () {
type: 'separator'
},
{
label: process.platform === 'win32'
? 'Close'
: 'Close Window',
accelerator: 'CmdOrCtrl+W',
role: 'close'
}
]
@@ -111,23 +107,16 @@ function getMenuTemplate () {
label: 'Edit',
submenu: [
{
label: 'Cut',
accelerator: 'CmdOrCtrl+X',
role: 'cut'
},
{
label: 'Copy',
accelerator: 'CmdOrCtrl+C',
role: 'copy'
},
{
label: 'Paste Torrent Address',
accelerator: 'CmdOrCtrl+V',
role: 'paste'
},
{
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
role: 'selectall'
},
{
@@ -285,7 +274,6 @@ function getMenuTemplate () {
label: config.APP_NAME,
submenu: [
{
label: 'About ' + config.APP_NAME,
role: 'about'
},
{
@@ -300,7 +288,6 @@ function getMenuTemplate () {
type: 'separator'
},
{
label: 'Services',
role: 'services',
submenu: []
},
@@ -308,17 +295,12 @@ function getMenuTemplate () {
type: 'separator'
},
{
label: 'Hide ' + config.APP_NAME,
accelerator: 'Command+H',
role: 'hide'
},
{
label: 'Hide Others',
accelerator: 'Command+Alt+H',
role: 'hideothers'
},
{
label: 'Show All',
role: 'unhide'
},
{
@@ -334,19 +316,15 @@ function getMenuTemplate () {
// Add Window menu (OS X)
template.splice(5, 0, {
label: 'Window',
role: 'window',
submenu: [
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
role: 'front'
}
]