Merge pull request #506 from feross/update-deps

OS X: Bounce the Downloads stack when download completes
This commit is contained in:
Feross Aboukhadijeh
2016-05-13 12:26:52 -07:00
3 changed files with 22 additions and 6 deletions

View File

@@ -93,6 +93,13 @@ function init () {
windows.focusWindow(windows[windowName]) windows.focusWindow(windows[windowName])
}) })
ipcMain.on('downloadFinished', function (e, filePath) {
if (app.dock) {
// Bounces the Downloads stack if the filePath is inside the Downloads folder.
app.dock.downloadFinished(filePath)
}
})
ipcMain.on('checkForVLC', function (e) { ipcMain.on('checkForVLC', function (e) {
vlc.checkForVLC(function (isInstalled) { vlc.checkForVLC(function (isInstalled) {
windows.main.send('checkForVLC', isInstalled) windows.main.send('checkForVLC', isInstalled)
@@ -216,7 +223,9 @@ function setAspectRatio (aspectRatio) {
// Display string in dock badging area (OS X) // Display string in dock badging area (OS X)
function setBadge (text) { function setBadge (text) {
log('setBadge %s', text) log('setBadge %s', text)
if (app.dock) app.dock.setBadge(String(text)) if (app.dock) {
app.dock.setBadge(String(text))
}
} }
// Show progress bar. Valid range is [0, 1]. Remove when < 0; indeterminate when > 1. // Show progress bar. Valid range is [0, 1]. Remove when < 0; indeterminate when > 1.

View File

@@ -21,14 +21,16 @@ var config = require('../config')
var log = require('./log') var log = require('./log')
var windows = require('./windows') var windows = require('./windows')
var appMenu, dockMenu var appMenu
function init () { function init () {
appMenu = electron.Menu.buildFromTemplate(getAppMenuTemplate()) appMenu = electron.Menu.buildFromTemplate(getAppMenuTemplate())
electron.Menu.setApplicationMenu(appMenu) electron.Menu.setApplicationMenu(appMenu)
dockMenu = electron.Menu.buildFromTemplate(getDockMenuTemplate()) if (app.dock) {
if (app.dock) app.dock.setMenu(dockMenu) var dockMenu = electron.Menu.buildFromTemplate(getDockMenuTemplate())
app.dock.setMenu(dockMenu)
}
} }
function toggleFullScreen (flag) { function toggleFullScreen (flag) {

View File

@@ -773,6 +773,7 @@ function torrentDone (torrentKey, torrentInfo) {
state.dock.badge += 1 state.dock.badge += 1
} }
showDoneNotification(torrentSummary) showDoneNotification(torrentSummary)
ipcRenderer.send('downloadFinished', getTorrentPath(torrentSummary))
} }
update() update()
@@ -1018,12 +1019,16 @@ function openTorrentContextMenu (infoHash) {
menu.popup(electron.remote.getCurrentWindow()) menu.popup(electron.remote.getCurrentWindow())
} }
function showItemInFolder (torrentSummary) { function getTorrentPath (torrentSummary) {
var itemPath = path.join(torrentSummary.path, torrentSummary.files[0].path) var itemPath = path.join(torrentSummary.path, torrentSummary.files[0].path)
if (torrentSummary.files.length > 1) { if (torrentSummary.files.length > 1) {
itemPath = path.dirname(itemPath) itemPath = path.dirname(itemPath)
} }
ipcRenderer.send('showItemInFolder', itemPath) return itemPath
}
function showItemInFolder (torrentSummary) {
ipcRenderer.send('showItemInFolder', getTorrentPath(torrentSummary))
} }
function saveTorrentFileAs (torrentSummary) { function saveTorrentFileAs (torrentSummary) {