@@ -39,12 +39,6 @@ class SettingsView : Subview
39
39
private const string GitInstallTitle = "Git installation" ;
40
40
private const string GitInstallMissingMessage =
41
41
"GitHub was unable to locate a valid Git install. Please specify install location or install git." ;
42
- private const string GitInstallBrowseTitle = "Select git binary" ;
43
- private const string GitInstallPickInvalidTitle = "Invalid Git install" ;
44
- private const string GitInstallPickInvalidMessage = "The selected file is not a valid Git install. {0}" ;
45
- private const string GitInstallPickInvalidOK = "OK" ;
46
- private const string GitInstallFindButton = "Find install" ;
47
- private const string GitInstallURL = "http://desktop.github.com" ;
48
42
private const string GitIgnoreRulesTitle = "gitignore rules" ;
49
43
private const string GitIgnoreRulesEffect = "Effect" ;
50
44
private const string GitIgnoreRulesFile = "File" ;
@@ -88,10 +82,19 @@ class SettingsView : Subview
88
82
[ SerializeField ] private string newGitEmail ;
89
83
[ SerializeField ] private string newRepositoryRemoteUrl ;
90
84
[ SerializeField ] private User cachedUser ;
85
+ [ SerializeField ] private GitPathView gitPathView = new GitPathView ( ) ;
86
+
87
+ public override void InitializeView ( IView parent )
88
+ {
89
+ base . InitializeView ( parent ) ;
90
+ gitPathView . InitializeView ( this ) ;
91
+ }
92
+
91
93
92
94
public override void OnEnable ( )
93
95
{
94
96
base . OnEnable ( ) ;
97
+ gitPathView . OnEnable ( ) ;
95
98
AttachHandlers ( Repository ) ;
96
99
97
100
remoteHasChanged = true ;
@@ -100,18 +103,25 @@ public override void OnEnable()
100
103
public override void OnDisable ( )
101
104
{
102
105
base . OnDisable ( ) ;
106
+ gitPathView . OnDisable ( ) ;
103
107
DetachHandlers ( Repository ) ;
104
108
}
105
109
106
110
public override void OnDataUpdate ( )
107
111
{
108
112
base . OnDataUpdate ( ) ;
113
+
114
+ if ( gitPathView != null )
115
+ {
116
+ gitPathView . OnDataUpdate ( ) ;
117
+ }
109
118
MaybeUpdateData ( ) ;
110
119
}
111
120
112
121
public override void OnRepositoryChanged ( IRepository oldRepository )
113
122
{
114
123
base . OnRepositoryChanged ( oldRepository ) ;
124
+ gitPathView . OnRepositoryChanged ( oldRepository ) ;
115
125
116
126
DetachHandlers ( oldRepository ) ;
117
127
AttachHandlers ( Repository ) ;
@@ -167,7 +177,7 @@ public override void OnGUI()
167
177
GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
168
178
}
169
179
170
- OnInstallPathGUI ( ) ;
180
+ gitPathView . OnGUI ( ) ;
171
181
OnPrivacyGui ( ) ;
172
182
OnLoggingSettingsGui ( ) ;
173
183
}
@@ -371,20 +381,6 @@ private void OnRepositorySettingsGUI()
371
381
EditorGUI . EndDisabledGroup ( ) ;
372
382
}
373
383
374
- private bool ValidateGitInstall ( string path )
375
- {
376
- if ( String . IsNullOrEmpty ( path ) )
377
- return false ;
378
- if ( ! GitClient . ValidateGitInstall ( path . ToNPath ( ) ) )
379
- {
380
- EditorUtility . DisplayDialog ( GitInstallPickInvalidTitle , String . Format ( GitInstallPickInvalidMessage , path ) ,
381
- GitInstallPickInvalidOK ) ;
382
- return false ;
383
- }
384
-
385
- return true ;
386
- }
387
-
388
384
private bool OnIssuesGUI ( )
389
385
{
390
386
IList < ProjectConfigurationIssue > projectConfigurationIssues ;
@@ -431,7 +427,8 @@ private bool OnIssuesGUI()
431
427
{
432
428
Styles . BeginInitialStateArea ( GitInstallTitle , GitInstallMissingMessage ) ;
433
429
{
434
- OnInstallPathGUI ( ) ;
430
+ //TODO: This is removed in another branch anyway
431
+ //OnInstallPathGUI();
435
432
}
436
433
Styles . EndInitialStateArea ( ) ;
437
434
@@ -685,71 +682,6 @@ private void OnGitLfsLocksGUI()
685
682
EditorGUI . EndDisabledGroup ( ) ;
686
683
}
687
684
688
- private void OnInstallPathGUI ( )
689
- {
690
- string gitExecPath = null ;
691
- string extension = null ;
692
- string gitInstallPath = null ;
693
- if ( Environment != null )
694
- {
695
- extension = Environment . ExecutableExtension ;
696
- if ( Environment . IsWindows )
697
- {
698
- extension = extension . TrimStart ( '.' ) ;
699
- }
700
-
701
- gitInstallPath = Environment . GitInstallPath ;
702
-
703
- if ( Environment . GitExecutablePath != null )
704
- gitExecPath = Environment . GitExecutablePath . ToString ( ) ;
705
- }
706
-
707
- // Install path
708
- GUILayout . Label ( GitInstallTitle , EditorStyles . boldLabel ) ;
709
-
710
- EditorGUI . BeginDisabledGroup ( isBusy || gitExecPath == null ) ;
711
- {
712
- // Install path field
713
- EditorGUI . BeginChangeCheck ( ) ;
714
- {
715
- //TODO: Verify necessary value for a non Windows OS
716
- Styles . PathField ( ref gitExecPath ,
717
- ( ) => EditorUtility . OpenFilePanel ( GitInstallBrowseTitle ,
718
- gitInstallPath ,
719
- extension ) , ValidateGitInstall ) ;
720
- }
721
- if ( EditorGUI . EndChangeCheck ( ) )
722
- {
723
- Logger . Trace ( "Setting GitExecPath: " + gitExecPath ) ;
724
-
725
- Manager . SystemSettings . Set ( Constants . GitInstallPathKey , gitExecPath ) ;
726
- Environment . GitExecutablePath = gitExecPath . ToNPath ( ) ;
727
- }
728
-
729
- GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
730
-
731
- GUILayout . BeginHorizontal ( ) ;
732
- {
733
- // Find button - for attempting to locate a new install
734
- if ( GUILayout . Button ( GitInstallFindButton , GUILayout . ExpandWidth ( false ) ) )
735
- {
736
- var task = new ProcessTask < NPath > ( Manager . CancellationToken , new FirstLineIsPathOutputProcessor ( ) )
737
- . Configure ( Manager . ProcessManager , Environment . IsWindows ? "where" : "which" , "git" )
738
- . FinallyInUI ( ( success , ex , path ) =>
739
- {
740
- if ( success && ! string . IsNullOrEmpty ( path ) )
741
- {
742
- Environment . GitExecutablePath = path ;
743
- GUIUtility . keyboardControl = GUIUtility . hotControl = 0 ;
744
- }
745
- } ) ;
746
- }
747
- }
748
- GUILayout . EndHorizontal ( ) ;
749
- }
750
- EditorGUI . EndDisabledGroup ( ) ;
751
- }
752
-
753
685
private void OnPrivacyGui ( )
754
686
{
755
687
var service = Manager != null && Manager . UsageTracker != null ? Manager . UsageTracker : null ;
0 commit comments