fix(prefs): Focus main window when open prefs and prevent dupe sheets

- Fixes #498
- Fixes #484
This commit is contained in:
Juan Tejada 2015-11-28 09:04:55 -08:00
parent 242b54eea6
commit 84adfb3bdf

View file

@ -2,11 +2,11 @@
Actions, Actions,
WorkspaceStore, WorkspaceStore,
ComponentRegistry} = require 'nylas-exports' ComponentRegistry} = require 'nylas-exports'
{ipcRenderer} = require 'electron'
module.exports = module.exports =
activate: -> activate: ->
{ipcRenderer} = require 'electron'
React = require 'react' React = require 'react'
Cfg = PreferencesSectionStore.SectionConfig Cfg = PreferencesSectionStore.SectionConfig
@ -45,6 +45,8 @@ module.exports =
ipcRenderer.on 'open-preferences', => @_openPreferences() ipcRenderer.on 'open-preferences', => @_openPreferences()
_openPreferences: -> _openPreferences: ->
ipcRenderer.send 'command', 'application:show-main-window'
if WorkspaceStore.topSheet() isnt WorkspaceStore.Sheet.Preferences
Actions.pushSheet(WorkspaceStore.Sheet.Preferences) Actions.pushSheet(WorkspaceStore.Sheet.Preferences)
deactivate: -> deactivate: ->