diff --git a/package.json b/package.json index 141d89bee..13d7d8926 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/atom-application.coffee b/src/atom-application.coffee index dd09dcef6..a4f019dcb 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -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 diff --git a/src/atom-window.coffee b/src/atom-window.coffee index 5da1d3b2e..9e82a3542 100644 --- a/src/atom-window.coffee +++ b/src/atom-window.coffee @@ -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)