Merge pull request #506 from feross/update-deps
OS X: Bounce the Downloads stack when download completes
This commit is contained in:
11
main/ipc.js
11
main/ipc.js
@@ -93,6 +93,13 @@ function init () {
|
||||
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) {
|
||||
vlc.checkForVLC(function (isInstalled) {
|
||||
windows.main.send('checkForVLC', isInstalled)
|
||||
@@ -216,7 +223,9 @@ function setAspectRatio (aspectRatio) {
|
||||
// Display string in dock badging area (OS X)
|
||||
function setBadge (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.
|
||||
|
||||
@@ -21,14 +21,16 @@ var config = require('../config')
|
||||
var log = require('./log')
|
||||
var windows = require('./windows')
|
||||
|
||||
var appMenu, dockMenu
|
||||
var appMenu
|
||||
|
||||
function init () {
|
||||
appMenu = electron.Menu.buildFromTemplate(getAppMenuTemplate())
|
||||
electron.Menu.setApplicationMenu(appMenu)
|
||||
|
||||
dockMenu = electron.Menu.buildFromTemplate(getDockMenuTemplate())
|
||||
if (app.dock) app.dock.setMenu(dockMenu)
|
||||
if (app.dock) {
|
||||
var dockMenu = electron.Menu.buildFromTemplate(getDockMenuTemplate())
|
||||
app.dock.setMenu(dockMenu)
|
||||
}
|
||||
}
|
||||
|
||||
function toggleFullScreen (flag) {
|
||||
|
||||
@@ -773,6 +773,7 @@ function torrentDone (torrentKey, torrentInfo) {
|
||||
state.dock.badge += 1
|
||||
}
|
||||
showDoneNotification(torrentSummary)
|
||||
ipcRenderer.send('downloadFinished', getTorrentPath(torrentSummary))
|
||||
}
|
||||
|
||||
update()
|
||||
@@ -1018,12 +1019,16 @@ function openTorrentContextMenu (infoHash) {
|
||||
menu.popup(electron.remote.getCurrentWindow())
|
||||
}
|
||||
|
||||
function showItemInFolder (torrentSummary) {
|
||||
function getTorrentPath (torrentSummary) {
|
||||
var itemPath = path.join(torrentSummary.path, torrentSummary.files[0].path)
|
||||
if (torrentSummary.files.length > 1) {
|
||||
itemPath = path.dirname(itemPath)
|
||||
}
|
||||
ipcRenderer.send('showItemInFolder', itemPath)
|
||||
return itemPath
|
||||
}
|
||||
|
||||
function showItemInFolder (torrentSummary) {
|
||||
ipcRenderer.send('showItemInFolder', getTorrentPath(torrentSummary))
|
||||
}
|
||||
|
||||
function saveTorrentFileAs (torrentSummary) {
|
||||
|
||||
Reference in New Issue
Block a user