Merge pull request #900 from atom/mc-release-notes

API to Notify render processes when updates are available
This commit is contained in:
Matt Colyer 2013-10-01 16:41:56 -07:00
commit 42e254576c
3 changed files with 10 additions and 1 deletions

View File

@ -68,6 +68,7 @@
"markdown-preview": "0.6.0",
"metrics": "0.7.0",
"package-generator": "0.10.0",
"release-notes": "0.2.0",
"settings-view": "0.25.0",
"snippets": "0.6.0",
"spell-check": "0.6.0",

View File

@ -24,6 +24,7 @@ socketPath = '/tmp/atom.sock'
module.exports =
class AtomApplication
_.extend @prototype, EventEmitter.prototype
updateVersion: null
# Public: The entry point into the Atom application.
@open: (options) ->
@ -147,7 +148,9 @@ class AtomApplication
autoUpdater.on 'ready-for-update-on-quit', (event, version, quitAndUpdateCallback) =>
event.preventDefault()
@updateVersion = version
@applicationMenu.showDownloadUpdateItem(version, quitAndUpdateCallback)
atomWindow.sendCommand('window:update-available', version) for atomWindow in @windows
# A request from the associated render process to open a new render process.
ipc.on 'open', (processId, routingId, options) =>
@ -307,3 +310,8 @@ class AtomApplication
promptForPath: ({devMode}={}) ->
pathsToOpen = dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory']
@openPaths({pathsToOpen, devMode})
# Public: If an update is available, it returns the new version string
# otherwise it returns null.
getUpdateVersion: ->
@updateVersion

View File

@ -2,7 +2,6 @@ BrowserWindow = require 'browser-window'
Menu = require 'menu'
MenuItem = require 'menu-item'
ContextMenu = require 'context-menu'
app = require 'app'
dialog = require 'dialog'
ipc = require 'ipc'
path = require 'path'
@ -96,6 +95,7 @@ class AtomWindow
if @loaded
@focus()
@sendCommand('window:open-path', {pathToOpen, initialLine})
@sendCommand('window:update-available', global.atomApplication.getUpdateVersion()) if global.atomApplication.getUpdateVersion()
else
@browserWindow.once 'window:loaded', => @openPath(pathToOpen, initialLine)