2015-12-01 03:43:49 +08:00
|
|
|
{PreferencesUIStore,
|
2015-11-24 04:20:51 +08:00
|
|
|
Actions,
|
|
|
|
WorkspaceStore,
|
|
|
|
ComponentRegistry} = require 'nylas-exports'
|
2015-11-29 01:04:55 +08:00
|
|
|
{ipcRenderer} = require 'electron'
|
2015-10-01 03:29:56 +08:00
|
|
|
|
2015-08-15 06:40:11 +08:00
|
|
|
module.exports =
|
2015-11-24 04:20:51 +08:00
|
|
|
|
|
|
|
activate: ->
|
2015-08-15 06:40:11 +08:00
|
|
|
React = require 'react'
|
|
|
|
|
2015-12-01 03:43:49 +08:00
|
|
|
Cfg = PreferencesUIStore.TabItem
|
2015-10-30 05:20:41 +08:00
|
|
|
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'General'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'General'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-general'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 1
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'Accounts'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'Accounts'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-accounts'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 2
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'Shortcuts'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'Shortcuts'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-keymaps'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 3
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
2015-11-24 04:20:51 +08:00
|
|
|
|
|
|
|
WorkspaceStore.defineSheet 'Preferences', {},
|
|
|
|
split: ['Preferences']
|
|
|
|
list: ['Preferences']
|
|
|
|
|
|
|
|
PreferencesRoot = require('./preferences-root')
|
|
|
|
ComponentRegistry.register PreferencesRoot,
|
|
|
|
location: WorkspaceStore.Location.Preferences
|
2015-10-01 03:29:56 +08:00
|
|
|
|
|
|
|
Actions.openPreferences.listen(@_openPreferences)
|
2015-11-24 14:09:17 +08:00
|
|
|
ipcRenderer.on 'open-preferences', => @_openPreferences()
|
2015-10-01 03:29:56 +08:00
|
|
|
|
2015-11-24 04:20:51 +08:00
|
|
|
_openPreferences: ->
|
2015-11-29 01:04:55 +08:00
|
|
|
ipcRenderer.send 'command', 'application:show-main-window'
|
|
|
|
if WorkspaceStore.topSheet() isnt WorkspaceStore.Sheet.Preferences
|
|
|
|
Actions.pushSheet(WorkspaceStore.Sheet.Preferences)
|
2015-08-15 06:40:11 +08:00
|
|
|
|
|
|
|
deactivate: ->
|
|
|
|
|
|
|
|
serialize: -> @state
|