@@ -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
@@ -45,8 +53,11 @@ export default class GitTabHeaderController extends React.Component {
4553 ) {
4654 this . disposable . dispose ( ) ;
4755 this . disposable = new CompositeDisposable ( ) ;
48- this . disposable . add ( this . props . onDidChangeWorkDirs ( this . resetWorkDirs ) ) ;
49- this . disposable . add ( this . props . onDidUpdateRepo ( this . updateCommitter ) ) ;
56+ this . disposable . add (
57+ this . props . onDidChangeWorkDirs ( this . resetWorkDirs ) ,
58+ this . props . onDidUpdateRepo ( this . updateCommitter ) ,
59+ this . props . config . onDidChange ( 'github.useProjectFromActivePanel' , this . handleUseProjectFromActivePanelChange ) ,
60+ ) ;
5061 }
5162 if ( prevProps . getCommitter !== this . props . getCommitter ) {
5263 this . updateCommitter ( ) ;
@@ -56,6 +67,7 @@ export default class GitTabHeaderController extends React.Component {
5667 render ( ) {
5768 return (
5869 < GitTabHeaderView
70+ disableProjectSelection = { this . state . disableProjectSelection }
5971 committer = { this . state . committer }
6072
6173 // Workspace
@@ -74,6 +86,10 @@ export default class GitTabHeaderController extends React.Component {
7486 } ) ) ;
7587 }
7688
89+ handleUseProjectFromActivePanelChange = ( { newValue} ) => {
90+ this . setState ( { disableProjectSelection : newValue } ) ;
91+ }
92+
7793 updateCommitter = async ( ) => {
7894 const committer = await this . props . getCommitter ( ) || nullAuthor ;
7995 if ( this . _isMounted ) {
0 commit comments