@@ -22,6 +22,7 @@ class UserSettingsView : Subview
22
22
[ SerializeField ] private string gitEmail ;
23
23
[ SerializeField ] private string newGitName ;
24
24
[ SerializeField ] private string newGitEmail ;
25
+ [ SerializeField ] private bool needsSaving ;
25
26
26
27
public override void InitializeView ( IView parent )
27
28
{
@@ -42,11 +43,17 @@ public override void OnGUI()
42
43
43
44
EditorGUI . BeginDisabledGroup ( IsBusy || Parent . IsBusy ) ;
44
45
{
45
- newGitName = EditorGUILayout . TextField ( GitConfigNameLabel , newGitName ) ;
46
- newGitEmail = EditorGUILayout . TextField ( GitConfigEmailLabel , newGitEmail ) ;
46
+ EditorGUI . BeginChangeCheck ( ) ;
47
+ {
48
+ newGitName = EditorGUILayout . TextField ( GitConfigNameLabel , newGitName ) ;
49
+ newGitEmail = EditorGUILayout . TextField ( GitConfigEmailLabel , newGitEmail ) ;
50
+ }
47
51
48
- var needsSaving = ( newGitName != gitName || newGitEmail != gitEmail )
49
- && ! ( string . IsNullOrEmpty ( newGitName ) || string . IsNullOrEmpty ( newGitEmail ) ) ;
52
+ if ( EditorGUI . EndChangeCheck ( ) )
53
+ {
54
+ needsSaving = ! ( string . IsNullOrEmpty ( newGitName ) || string . IsNullOrEmpty ( newGitEmail ) )
55
+ && ( newGitName != gitName || newGitEmail != gitEmail ) ;
56
+ }
50
57
51
58
EditorGUI . BeginDisabledGroup ( ! needsSaving ) ;
52
59
{
@@ -71,6 +78,8 @@ public override void OnGUI()
71
78
gitEmail = newGitEmail ;
72
79
}
73
80
81
+ needsSaving = false ;
82
+
74
83
Redraw ( ) ;
75
84
Finish ( true ) ;
76
85
}
@@ -103,6 +112,7 @@ private void MaybeUpdateData()
103
112
{
104
113
newGitName = gitName = Repository . User . Name ;
105
114
newGitEmail = gitEmail = Repository . User . Email ;
115
+ needsSaving = false ;
106
116
}
107
117
}
108
118
}
@@ -127,6 +137,7 @@ private void UpdateUserDataFromClient()
127
137
{
128
138
newGitName = gitName = user . Name ;
129
139
newGitEmail = gitEmail = user . Email ;
140
+ needsSaving = false ;
130
141
Redraw ( ) ;
131
142
}
132
143
} ) . Start ( ) ;
0 commit comments