Make project's Git repository a window global

This allows it to operate independently of the
project and mirror the availability of the root view
and project.
This commit is contained in:
Kevin Sawicki
2013-02-27 17:50:37 -08:00
parent 219a8581fd
commit 2ec4d558ba
10 changed files with 36 additions and 31 deletions

View File

@@ -91,6 +91,7 @@ window.handleWindowEvents = ->
window.buildProjectAndRootView = ->
RootView = require 'root-view'
Project = require 'project'
Git = require 'git'
pathToOpen = atom.getPathToOpen()
windowState = atom.getRootViewStateForPath(pathToOpen) ? {}
@@ -102,6 +103,11 @@ window.buildProjectAndRootView = ->
$(rootViewParentSelector).append(rootView)
window.git = Git.open(project.getPath())
project.on 'path-changed', ->
window.git?.destroy()
window.git = Git.open(project.getPath())
window.stylesheetElementForId = (id) ->
$("head style[id='#{id}']")