@@ -6,6 +6,7 @@ import GitTabHeaderView from '../views/git-tab-header-view';
66
77export default class GitTabHeaderController extends React . Component {
88 static propTypes = {
9+ config : PropTypes . object . isRequired ,
910 getCommitter : PropTypes . func . isRequired ,
1011
1112 // Workspace
@@ -21,7 +22,11 @@ export default class GitTabHeaderController extends React.Component {
2122 constructor ( props ) {
2223 super ( props ) ;
2324 this . _isMounted = false ;
24- this . state = { currentWorkDirs : [ ] , committer : nullAuthor } ;
25+ this . state = {
26+ currentWorkDirs : [ ] ,
27+ committer : nullAuthor ,
28+ disableProjectSelection : this . props . config . get ( 'github.useProjectFromActivePanel' ) ,
29+ } ;
2530 this . disposable = new CompositeDisposable ( ) ;
2631 }
2732
@@ -33,8 +38,11 @@ export default class GitTabHeaderController extends React.Component {
3338
3439 componentDidMount ( ) {
3540 this . _isMounted = true ;
36- this . disposable . add ( this . props . onDidChangeWorkDirs ( this . resetWorkDirs ) ) ;
37- this . disposable . add ( this . props . onDidUpdateRepo ( this . updateCommitter ) ) ;
41+ this . disposable . add (
42+ this . props . onDidChangeWorkDirs ( this . resetWorkDirs ) ,
43+ this . props . onDidUpdateRepo ( this . updateCommitter ) ,
44+ this . props . config . onDidChange ( 'github.useProjectFromActivePanel' , this . handleUseProjectFromActivePanelChange ) ,
45+ ) ;
3846 this . updateCommitter ( ) ;
3947 }
4048
@@ -47,6 +55,7 @@ export default class GitTabHeaderController extends React.Component {
4755 this . disposable = new CompositeDisposable ( ) ;
4856 this . disposable . add ( this . props . onDidChangeWorkDirs ( this . resetWorkDirs ) ) ;
4957 this . disposable . add ( this . props . onDidUpdateRepo ( this . updateCommitter ) ) ;
58+ this . disposable . add ( this . props . config . onDidChange ( 'github.useProjectFromActivePanel' , this . handleUseProjectFromActivePanelChange ) ) ;
5059 }
5160 if ( prevProps . getCommitter !== this . props . getCommitter ) {
5261 this . updateCommitter ( ) ;
@@ -56,6 +65,7 @@ export default class GitTabHeaderController extends React.Component {
5665 render ( ) {
5766 return (
5867 < GitTabHeaderView
68+ disableProjectSelection = { this . state . disableProjectSelection }
5969 committer = { this . state . committer }
6070
6171 // Workspace
@@ -74,6 +84,10 @@ export default class GitTabHeaderController extends React.Component {
7484 } ) ) ;
7585 }
7686
87+ handleUseProjectFromActivePanelChange = ( { newValue} ) => {
88+ this . setState ( { disableProjectSelection : newValue } ) ;
89+ }
90+
7791 updateCommitter = async ( ) => {
7892 const committer = await this . props . getCommitter ( ) || nullAuthor ;
7993 if ( this . _isMounted ) {
0 commit comments