Add a theme-added event to the theme manager

This commit is contained in:
Ben Ogle
2013-09-10 16:17:35 -07:00
parent d3eec2db05
commit 261d386809
2 changed files with 18 additions and 0 deletions

View File

@@ -23,6 +23,9 @@ class ThemeManager
getAvailableNames: ->
path.basename(themePath).split('.')[0] for themePath in @getAvailablePaths()
getThemes: ->
_.clone(@loadedThemes)
unload: ->
removeStylesheet(@userStylesheetPath) if @userStylesheetPath?
theme.deactivate() while theme = @loadedThemes.pop()
@@ -38,7 +41,9 @@ class ThemeManager
loadTheme: (name) ->
try
theme = new Theme(name)
@loadedThemes.push(new Theme(name))
@trigger('theme-loaded', theme)
catch error
console.warn("Failed to load theme #{name}", error.stack ? error)