diff --git a/src/atom-application.coffee b/src/atom-application.coffee index 846b5805a..a4f019dcb 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -234,7 +234,7 @@ class AtomApplication else resourcePath = @resourcePath bootstrapScript = require.resolve('./window-bootstrap') - openedWindow = new AtomWindow({pathToOpen, initialLine, bootstrapScript, resourcePath, devMode, @updateVersion}) + openedWindow = new AtomWindow({pathToOpen, initialLine, bootstrapScript, resourcePath, devMode}) if pidToKillWhenClosed? @pidsToOpenWindows[pidToKillWhenClosed] = openedWindow @@ -264,7 +264,7 @@ class AtomApplication console.log "Joining session #{sessionId}" if sessionId bootstrapScript = 'collaboration/lib/bootstrap' - new AtomWindow({bootstrapScript, @resourcePath, sessionId, devMode, @updateVersion}) + new AtomWindow({bootstrapScript, @resourcePath, sessionId, devMode}) else console.log "Opening unknown url #{urlToOpen}" @@ -288,7 +288,7 @@ class AtomApplication isSpec = true devMode = true - new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, @updateVersion}) + new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory}) runBenchmarks: -> try @@ -297,7 +297,7 @@ class AtomApplication bootstrapScript = require.resolve(path.resolve(__dirname, '..', 'benchmark', 'benchmark-bootstrap')) isSpec = true # Needed because this flag adds the spec directory to the NODE_PATH - new AtomWindow({bootstrapScript, @resourcePath, isSpec, @updateVersion}) + new AtomWindow({bootstrapScript, @resourcePath, isSpec}) # Private: Opens a native dialog to prompt the user for a path. # @@ -310,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 3e242bb22..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' @@ -17,7 +16,7 @@ class AtomWindow isSpec: null constructor: (settings={}) -> - {@resourcePath, pathToOpen, initialLine, @isSpec, @updateVersion} = settings + {@resourcePath, pathToOpen, initialLine, @isSpec} = settings global.atomApplication.addWindow(this) @setupNodePath(@resourcePath) @@ -28,7 +27,7 @@ class AtomWindow @handleEvents() - loadSettings = _.omit(settings, 'updateVersion') + loadSettings = _.extend({}, settings) loadSettings.windowState ?= '' loadSettings.initialPath = pathToOpen try @@ -96,7 +95,7 @@ class AtomWindow if @loaded @focus() @sendCommand('window:open-path', {pathToOpen, initialLine}) - @sendCommand('window:update-available', @updateVersion) if @updateVersion + @sendCommand('window:update-available', global.atomApplication.getUpdateVersion()) if global.atomApplication.getUpdateVersion() else @browserWindow.once 'window:loaded', => @openPath(pathToOpen, initialLine)