@@ -135,7 +135,7 @@ public override void OnGUI()
135
135
OnBroadGUI ( ) ;
136
136
else
137
137
#endif
138
- OnEmbeddedGUI ( ) ;
138
+ OnEmbeddedGUI ( ) ;
139
139
140
140
#if ENABLE_BROADMODE
141
141
if ( Event . current . type == EventType . Repaint && EvaluateBroadMode ( ) )
@@ -207,7 +207,8 @@ private void RefreshLog()
207
207
{
208
208
if ( Repository != null )
209
209
{
210
- GitClient . Log ( ) . ThenInUI ( ( success , log ) => {
210
+ GitClient . Log ( ) . ThenInUI ( ( success , log ) =>
211
+ {
211
212
if ( success ) OnLogUpdate ( log ) ;
212
213
} ) . Start ( ) ;
213
214
}
@@ -308,16 +309,19 @@ private void DoOfferToInitializeRepositoryGUI()
308
309
GUILayout . FlexibleSpace ( ) ;
309
310
310
311
var enabled = GUI . enabled ;
311
- GUI . enabled = ! isBusy ;
312
-
313
- if ( GUILayout . Button ( Localization . InitializeRepositoryButtonText , "Button" ) )
312
+ EditorGUI . BeginDisabledGroup ( isBusy ) ;
314
313
{
315
- isBusy = true ;
316
- Manager . InitializeRepository ( )
317
- . FinallyInUI ( ( ) => isBusy = false )
318
- . Start ( ) ;
314
+ if ( GUILayout . Button ( Localization . InitializeRepositoryButtonText , "Button" ) )
315
+ {
316
+ isBusy = true ;
317
+ Manager . InitializeRepository ( )
318
+ . FinallyInUI ( ( ) => isBusy = false )
319
+ . Start ( ) ;
320
+ }
319
321
}
322
+ EditorGUI . EndDisabledGroup ( ) ;
320
323
GUI . enabled = enabled ;
324
+
321
325
GUILayout . FlexibleSpace ( ) ;
322
326
GUILayout . EndHorizontal ( ) ;
323
327
@@ -335,8 +339,8 @@ public void OnEmbeddedGUI()
335
339
EditorGUI . BeginDisabledGroup ( historyTarget == null ) ;
336
340
{
337
341
if ( GUILayout . Button (
338
- historyTarget == null ? HistoryFocusAll : String . Format ( HistoryFocusSingle , historyTarget . name ) ,
339
- Styles . HistoryToolbarButtonStyle )
342
+ historyTarget == null ? HistoryFocusAll : String . Format ( HistoryFocusSingle , historyTarget . name ) ,
343
+ Styles . HistoryToolbarButtonStyle )
340
344
)
341
345
{
342
346
historyTarget = null ;
@@ -351,53 +355,65 @@ public void OnEmbeddedGUI()
351
355
var isPublished = Repository . CurrentRemote . HasValue ;
352
356
if ( isPublished )
353
357
{
354
- GUI . enabled = currentRemote != null ;
355
- var fetchClicked = GUILayout . Button ( FetchButtonText , Styles . HistoryToolbarButtonStyle ) ;
356
- GUI . enabled = true ;
357
- if ( fetchClicked )
358
+ // Fetch button
359
+ EditorGUI . BeginDisabledGroup ( currentRemote == null ) ;
358
360
{
359
- Fetch ( ) ;
361
+ var fetchClicked = GUILayout . Button ( FetchButtonText , Styles . HistoryToolbarButtonStyle ) ;
362
+ if ( fetchClicked )
363
+ {
364
+ Fetch ( ) ;
365
+ }
360
366
}
367
+ EditorGUI . EndDisabledGroup ( ) ;
361
368
362
- // Pull / Push buttons
363
- var pullButtonText = statusBehind > 0 ? String . Format ( PullButtonCount , statusBehind ) : PullButton ;
364
- GUI . enabled = currentRemote != null ;
365
- var pullClicked = GUILayout . Button ( pullButtonText , Styles . HistoryToolbarButtonStyle ) ;
366
- GUI . enabled = true ;
367
- if ( pullClicked &&
368
- EditorUtility . DisplayDialog ( PullConfirmTitle ,
369
- String . Format ( PullConfirmDescription , currentRemote ) ,
370
- PullConfirmYes ,
371
- PullConfirmCancel )
372
- )
369
+ // Pull button
370
+ EditorGUI . BeginDisabledGroup ( currentRemote == null ) ;
373
371
{
374
- Pull ( ) ;
372
+ var pullButtonText = statusBehind > 0 ? String . Format ( PullButtonCount , statusBehind ) : PullButton ;
373
+ var pullClicked = GUILayout . Button ( pullButtonText , Styles . HistoryToolbarButtonStyle ) ;
374
+
375
+ if ( pullClicked &&
376
+ EditorUtility . DisplayDialog ( PullConfirmTitle ,
377
+ String . Format ( PullConfirmDescription , currentRemote ) ,
378
+ PullConfirmYes ,
379
+ PullConfirmCancel )
380
+ )
381
+ {
382
+ Pull ( ) ;
383
+ }
375
384
}
385
+ EditorGUI . EndDisabledGroup ( ) ;
376
386
377
- var pushButtonText = statusAhead > 0 ? String . Format ( PushButtonCount , statusAhead ) : PushButton ;
378
- GUI . enabled = currentRemote != null && statusBehind == 0 ;
379
- var pushClicked = GUILayout . Button ( pushButtonText , Styles . HistoryToolbarButtonStyle ) ;
380
- GUI . enabled = true ;
381
- if ( pushClicked &&
382
- EditorUtility . DisplayDialog ( PushConfirmTitle ,
383
- String . Format ( PushConfirmDescription , currentRemote ) ,
384
- PushConfirmYes ,
385
- PushConfirmCancel )
386
- )
387
+ // Push button
388
+ EditorGUI . BeginDisabledGroup ( currentRemote == null || statusBehind != 0 ) ;
387
389
{
388
- Push ( ) ;
390
+ var pushButtonText = statusAhead > 0 ? String . Format ( PushButtonCount , statusAhead ) : PushButton ;
391
+ var pushClicked = GUILayout . Button ( pushButtonText , Styles . HistoryToolbarButtonStyle ) ;
392
+
393
+ if ( pushClicked &&
394
+ EditorUtility . DisplayDialog ( PushConfirmTitle ,
395
+ String . Format ( PushConfirmDescription , currentRemote ) ,
396
+ PushConfirmYes ,
397
+ PushConfirmCancel )
398
+ )
399
+ {
400
+ Push ( ) ;
401
+ }
389
402
}
403
+ EditorGUI . EndDisabledGroup ( ) ;
390
404
}
391
405
else
392
406
{
393
407
// Publishing a repo
394
- GUI . enabled = Platform . Keychain . Connections . Any ( ) ;
395
- var publishedClicked = GUILayout . Button ( PublishButton , Styles . HistoryToolbarButtonStyle ) ;
396
- if ( publishedClicked )
408
+ EditorGUI . BeginDisabledGroup ( ! Platform . Keychain . Connections . Any ( ) ) ;
397
409
{
398
- PublishWindow . Open ( ) ;
410
+ var publishedClicked = GUILayout . Button ( PublishButton , Styles . HistoryToolbarButtonStyle ) ;
411
+ if ( publishedClicked )
412
+ {
413
+ PublishWindow . Open ( ) ;
414
+ }
399
415
}
400
- GUI . enabled = true ;
416
+ EditorGUI . EndDisabledGroup ( ) ;
401
417
}
402
418
}
403
419
GUILayout . EndHorizontal ( ) ;
@@ -569,7 +585,8 @@ private void RevertCommit()
569
585
{
570
586
Repository
571
587
. Revert ( selection . CommitID )
572
- . FinallyInUI ( ( success , e ) => {
588
+ . FinallyInUI ( ( success , e ) =>
589
+ {
573
590
if ( ! success )
574
591
{
575
592
EditorUtility . DisplayDialog ( dialogTitle ,
@@ -699,7 +716,8 @@ private void Pull()
699
716
// (either git rebase --abort or git merge --abort)
700
717
}
701
718
} , true )
702
- . FinallyInUI ( ( success , e ) => {
719
+ . FinallyInUI ( ( success , e ) =>
720
+ {
703
721
if ( success )
704
722
{
705
723
EditorUtility . DisplayDialog ( Localization . PullActionTitle ,
@@ -722,7 +740,8 @@ private void Push()
722
740
var remote = Repository . CurrentRemote . HasValue ? Repository . CurrentRemote . Value . Name : String . Empty ;
723
741
Repository
724
742
. Push ( )
725
- . FinallyInUI ( ( success , e ) => {
743
+ . FinallyInUI ( ( success , e ) =>
744
+ {
726
745
if ( success )
727
746
{
728
747
EditorUtility . DisplayDialog ( Localization . PushActionTitle ,
@@ -744,7 +763,8 @@ private void Fetch()
744
763
var remote = Repository . CurrentRemote . HasValue ? Repository . CurrentRemote . Value . Name : String . Empty ;
745
764
Repository
746
765
. Fetch ( )
747
- . FinallyInUI ( ( success , e ) => {
766
+ . FinallyInUI ( ( success , e ) =>
767
+ {
748
768
if ( ! success )
749
769
{
750
770
EditorUtility . DisplayDialog ( FetchActionTitle , FetchFailureDescription ,
0 commit comments