From 33adaab8b1c25946762cc648fd8b92aa684ee157 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 7 Apr 2014 10:21:25 -0700 Subject: [PATCH] Add getMenu method --- src/browser/auto-update-manager.coffee | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index 284bfbca7..02a7d458d 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -3,31 +3,30 @@ dialog = require 'dialog' module.exports = class AutoUpdateManager - constructor: (@applicationMenu) -> - + constructor: -> # Only released versions should check for updates. return if /\w{7}/.test(@getVersion()) autoUpdater.setFeedUrl "https://atom.io/api/updates?version=#{@getVersion()}" autoUpdater.on 'checking-for-update', => - @applicationMenu.showDownloadingUpdateItem(false) - @applicationMenu.showInstallUpdateItem(false) - @applicationMenu.showCheckForUpdateItem(false) + @getMenu().showDownloadingUpdateItem(false) + @getMenu().showInstallUpdateItem(false) + @getMenu().showCheckForUpdateItem(false) autoUpdater.on 'update-not-available', => - @applicationMenu.showCheckForUpdateItem(true) + @getMenu().showCheckForUpdateItem(true) autoUpdater.on 'update-available', => - @applicationMenu.showDownloadingUpdateItem(true) + @getMenu().showDownloadingUpdateItem(true) autoUpdater.on 'update-downloaded', (event, releaseNotes, releaseVersion, releaseDate, releaseURL) => for atomWindow in @getWindows() atomWindow.sendCommand('window:update-available', [releaseVersion, releaseNotes]) - @applicationMenu.showInstallUpdateItem(true) + @getMenu().showInstallUpdateItem(true) autoUpdater.on 'error', (event, message) => - @applicationMenu.showCheckForUpdateItem(true) + @getMenu().showCheckForUpdateItem(true) # Check for update after Atom has fully started and the menus are created setTimeout((-> autoUpdater.checkForUpdates()), 5000) @@ -48,6 +47,9 @@ class AutoUpdateManager autoUpdater.removeListener 'update-not-available', @onUpdateNotAvailable dialog.showMessageBox type: 'warning', buttons: ['OK'], message: 'There was an error checking for updates.', detail: message + getMenu: -> + global.atomApplication.applicationMenu + getVersion: -> global.atomApplication.version