mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Use current window by default in atom.confirmSync
Closes atom/tree-view#7
This commit is contained in:
@@ -20,7 +20,10 @@ window.atom =
|
||||
contextMenu: new ContextMenuManager(remote.getCurrentWindow().loadSettings.devMode)
|
||||
|
||||
getLoadSettings: ->
|
||||
remote.getCurrentWindow().loadSettings
|
||||
@getCurrentWindow().loadSettings
|
||||
|
||||
getCurrentWindow: ->
|
||||
remote.getCurrentWindow()
|
||||
|
||||
getPackageState: (name) ->
|
||||
@packageStates[name]
|
||||
@@ -169,7 +172,7 @@ window.atom =
|
||||
chosen = @confirmSync(message, detailedMessage, buttons)
|
||||
callbacks[chosen]?()
|
||||
|
||||
confirmSync: (message, detailedMessage, buttons, browserWindow = null) ->
|
||||
confirmSync: (message, detailedMessage, buttons, browserWindow=@getCurrentWindow()) ->
|
||||
dialog.showMessageBox browserWindow,
|
||||
type: 'info'
|
||||
message: message
|
||||
@@ -181,30 +184,30 @@ window.atom =
|
||||
|
||||
showSaveDialogSync: (defaultPath) ->
|
||||
defaultPath ?= project?.getPath()
|
||||
currentWindow = remote.getCurrentWindow()
|
||||
currentWindow = @getCurrentWindow()
|
||||
dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath}
|
||||
|
||||
openDevTools: ->
|
||||
remote.getCurrentWindow().openDevTools()
|
||||
@getCurrentWindow().openDevTools()
|
||||
|
||||
toggleDevTools: ->
|
||||
remote.getCurrentWindow().toggleDevTools()
|
||||
@getCurrentWindow().toggleDevTools()
|
||||
|
||||
reload: ->
|
||||
remote.getCurrentWindow().restart()
|
||||
@getCurrentWindow().restart()
|
||||
|
||||
focus: ->
|
||||
remote.getCurrentWindow().focus()
|
||||
@getCurrentWindow().focus()
|
||||
$(window).focus()
|
||||
|
||||
show: ->
|
||||
remote.getCurrentWindow().show()
|
||||
@getCurrentWindow().show()
|
||||
|
||||
hide: ->
|
||||
remote.getCurrentWindow().hide()
|
||||
@getCurrentWindow().hide()
|
||||
|
||||
close: ->
|
||||
remote.getCurrentWindow().close()
|
||||
@getCurrentWindow().close()
|
||||
|
||||
exit: (status) ->
|
||||
app.exit(status)
|
||||
@@ -213,10 +216,10 @@ window.atom =
|
||||
@setFullScreen(!@isFullScreen())
|
||||
|
||||
setFullScreen: (fullScreen=false) ->
|
||||
remote.getCurrentWindow().setFullScreen(fullScreen)
|
||||
@getCurrentWindow().setFullScreen(fullScreen)
|
||||
|
||||
isFullScreen: ->
|
||||
remote.getCurrentWindow().isFullScreen()
|
||||
@getCurrentWindow().isFullScreen()
|
||||
|
||||
getHomeDirPath: ->
|
||||
app.getHomeDir()
|
||||
|
||||
@@ -224,12 +224,11 @@ class Pane extends View
|
||||
# Public: Prompt the user to save the given item.
|
||||
promptToSaveItem: (item) ->
|
||||
uri = item.getUri()
|
||||
currentWindow = require('remote').getCurrentWindow()
|
||||
chosen = atom.confirmSync(
|
||||
"'#{item.getTitle?() ? item.getUri()}' has changes, do you want to save them?"
|
||||
"Your changes will be lost if you close this item without saving."
|
||||
["Save", "Cancel", "Don't Save"]
|
||||
currentWindow
|
||||
atom.getCurrentWindow()
|
||||
)
|
||||
switch chosen
|
||||
when 0 then @saveItem(item, -> true)
|
||||
|
||||
Reference in New Issue
Block a user