From 18b126e0d20cd099d0499540254fce6920c5c381 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 9 May 2016 16:14:46 +0200 Subject: [PATCH] Remove unnecessary IPC --- main/index.js | 6 +++--- main/ipc.js | 2 -- main/menu.js | 9 +++++---- renderer/index.js | 3 --- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/main/index.js b/main/index.js index c880386b..e26d055c 100644 --- a/main/index.js +++ b/main/index.js @@ -120,11 +120,11 @@ function sliceArgv (argv) { function processArgv (argv) { argv.forEach(function (arg) { if (arg === '-n') { - windows.main.send('dispatch', 'showOpenSeedFiles') + menu.showOpenSeedFiles() } else if (arg === '-o') { - windows.main.send('dispatch', 'showOpenTorrentFile') + menu.showOpenTorrentFile() } else if (arg === '-u') { - windows.main.send('showOpenTorrentAddress') + menu.showOpenTorrentAddress() } else if (arg.startsWith('-psn')) { // Ignore OS X launchd "process serial number" argument // More: https://github.com/feross/webtorrent-desktop/issues/214 diff --git a/main/ipc.js b/main/ipc.js index 86eb0fe1..dca4a6ac 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -43,8 +43,6 @@ function init () { ipcMain.on('showOpenTorrentFile', menu.showOpenTorrentFile) - ipcMain.on('showOpenSeedFiles', menu.showOpenSeedFiles) - ipcMain.on('setBounds', function (e, bounds, maximize) { setBounds(bounds, maximize) }) diff --git a/main/menu.js b/main/menu.js index 0c883ac7..644ae4e5 100644 --- a/main/menu.js +++ b/main/menu.js @@ -1,11 +1,12 @@ module.exports = { init, + onPlayerClose, + onPlayerOpen, onToggleFullScreen, onWindowHide, onWindowShow, - onPlayerOpen, - onPlayerClose, showOpenSeedFiles, + showOpenTorrentAddress, showOpenTorrentFile, toggleFullScreen } @@ -111,8 +112,8 @@ function getMenuItem (label) { // Prompts the user for a file, then makes a torrent out of the data function showOpenSeedFile () { electron.dialog.showOpenDialog({ - title: 'Select a file for the torrent file', - properties: ['openFile'] + title: 'Select a file for the torrent file.', + properties: [ 'openFile' ] }, function (filenames) { if (!Array.isArray(filenames)) return var file = filenames[0] diff --git a/renderer/index.js b/renderer/index.js index 56930997..c0cbc2ee 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -211,9 +211,6 @@ function dispatch (action, ...args) { if (action === 'addTorrent') { addTorrent(args[0] /* torrent */) } - if (action === 'showOpenSeedFiles') { - ipcRenderer.send('showOpenSeedFiles') /* open file or folder to seed */ - } if (action === 'showOpenTorrentFile') { ipcRenderer.send('showOpenTorrentFile') /* open torrent file */ }