Remove unnecessary IPC

This commit is contained in:
Feross Aboukhadijeh
2016-05-09 16:14:46 +02:00
parent 82dff65572
commit 18b126e0d2
4 changed files with 8 additions and 12 deletions

View File

@@ -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

View File

@@ -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)
})

View File

@@ -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]

View File

@@ -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 */
}