@@ -24,8 +24,6 @@ class BranchesView : Subview
24
24
private const string WarningCheckoutBranchExistsOK = "Ok" ;
25
25
private const string NewBranchCancelButton = "x" ;
26
26
private const string NewBranchConfirmButton = "Create" ;
27
- private const string FavoritesSetting = "Favorites" ;
28
- private const string FavoritesTitle = "Favorites" ;
29
27
private const string CreateBranchTitle = "Create Branch" ;
30
28
private const string LocalTitle = "Local branches" ;
31
29
private const string RemoteTitle = "Remote branches" ;
@@ -38,11 +36,9 @@ class BranchesView : Subview
38
36
private bool showLocalBranches = true ;
39
37
private bool showRemoteBranches = true ;
40
38
41
- [ NonSerialized ] private List < BranchTreeNode > favorites = new List < BranchTreeNode > ( ) ;
42
39
[ NonSerialized ] private int listID = - 1 ;
43
40
[ NonSerialized ] private BranchTreeNode newNodeSelection ;
44
41
[ NonSerialized ] private BranchesMode targetMode ;
45
- [ NonSerialized ] private bool favoritesHasChanged ;
46
42
47
43
[ SerializeField ] private BranchTreeNode activeBranchNode ;
48
44
[ SerializeField ] private BranchTreeNode localRoot ;
@@ -51,7 +47,6 @@ class BranchesView : Subview
51
47
[ SerializeField ] private List < Remote > remotes = new List < Remote > ( ) ;
52
48
[ SerializeField ] private Vector2 scroll ;
53
49
[ SerializeField ] private BranchTreeNode selectedNode ;
54
- [ SerializeField ] private List < string > favoritesList = new List < string > ( ) ;
55
50
56
51
public override void InitializeView ( IView parent )
57
52
{
@@ -63,7 +58,6 @@ public override void OnEnable()
63
58
{
64
59
base . OnEnable ( ) ;
65
60
AttachHandlers ( Repository ) ;
66
- favoritesHasChanged = true ;
67
61
Refresh ( ) ;
68
62
}
69
63
@@ -81,11 +75,6 @@ public override void OnDataUpdate()
81
75
82
76
private void MaybeUpdateData ( )
83
77
{
84
- if ( favoritesHasChanged )
85
- {
86
- favoritesList = Manager . LocalSettings . Get ( FavoritesSetting , new List < string > ( ) ) ;
87
- favoritesHasChanged = false ;
88
- }
89
78
}
90
79
91
80
private void AttachHandlers ( IRepository repository )
@@ -150,28 +139,6 @@ public void OnEmbeddedGUI()
150
139
151
140
GUILayout . BeginVertical ( Styles . CommitFileAreaStyle ) ;
152
141
{
153
- // Favorites list
154
- if ( favorites . Count > 0 )
155
- {
156
- GUILayout . Label ( FavoritesTitle ) ;
157
- GUILayout . BeginHorizontal ( ) ;
158
- {
159
- GUILayout . BeginVertical ( ) ;
160
- {
161
- for ( var index = 0 ; index < favorites . Count ; ++ index )
162
- {
163
- OnTreeNodeGUI ( favorites [ index ] ) ;
164
- }
165
- }
166
-
167
- GUILayout . EndVertical ( ) ;
168
- }
169
-
170
- GUILayout . EndHorizontal ( ) ;
171
-
172
- GUILayout . Space ( Styles . BranchListSeperation ) ;
173
- }
174
-
175
142
// Local branches and "create branch" button
176
143
showLocalBranches = EditorGUILayout . Foldout ( showLocalBranches , LocalTitle ) ;
177
144
if ( showLocalBranches )
@@ -254,16 +221,6 @@ public void OnEmbeddedGUI()
254
221
255
222
private int CompareBranches ( GitBranch a , GitBranch b )
256
223
{
257
- if ( IsFavorite ( a . Name ) )
258
- {
259
- return - 1 ;
260
- }
261
-
262
- if ( IsFavorite ( b . Name ) )
263
- {
264
- return 1 ;
265
- }
266
-
267
224
if ( a . Name . Equals ( "master" ) )
268
225
{
269
226
return - 1 ;
@@ -277,11 +234,6 @@ private int CompareBranches(GitBranch a, GitBranch b)
277
234
return 0 ;
278
235
}
279
236
280
- private bool IsFavorite ( string branchName )
281
- {
282
- return ! String . IsNullOrEmpty ( branchName ) && favoritesList . Contains ( branchName ) ;
283
- }
284
-
285
237
private void BuildTree ( IEnumerable < GitBranch > local , IEnumerable < GitBranch > remote )
286
238
{
287
239
//Clear the selected node
@@ -297,9 +249,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
297
249
var tracking = new List < KeyValuePair < int , int > > ( ) ;
298
250
var localBranchNodes = new List < BranchTreeNode > ( ) ;
299
251
300
- // Prepare for updated favorites listing
301
- favorites . Clear ( ) ;
302
-
303
252
// Just build directly on the local root, keep track of active branch
304
253
localRoot = new BranchTreeNode ( "" , NodeType . Folder , false ) ;
305
254
for ( var index = 0 ; index < localBranches . Count ; ++ index )
@@ -327,12 +276,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
327
276
}
328
277
}
329
278
330
- // Add to favorites
331
- if ( favoritesList . Contains ( branch . Name ) )
332
- {
333
- favorites . Add ( node ) ;
334
- }
335
-
336
279
// Build into tree
337
280
BuildTree ( localRoot , node ) ;
338
281
}
@@ -371,12 +314,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
371
314
}
372
315
}
373
316
374
- // Add to favorites
375
- if ( favoritesList . Contains ( branch . Name ) )
376
- {
377
- favorites . Add ( node ) ;
378
- }
379
-
380
317
// Build on the root of the remote, just like with locals
381
318
BuildTree ( remotes [ remoteIndex ] . Root , node ) ;
382
319
}
@@ -409,26 +346,6 @@ private void BuildTree(BranchTreeNode parent, BranchTreeNode child)
409
346
BuildTree ( folder , child ) ;
410
347
}
411
348
412
- private void SetFavorite ( BranchTreeNode branch , bool favorite )
413
- {
414
- if ( string . IsNullOrEmpty ( branch . Name ) )
415
- {
416
- return ;
417
- }
418
-
419
- if ( ! favorite )
420
- {
421
- favorites . Remove ( branch ) ;
422
- Manager . LocalSettings . Set ( FavoritesSetting , favorites . Select ( x => x . Name ) . ToList ( ) ) ;
423
- }
424
- else
425
- {
426
- favorites . Remove ( branch ) ;
427
- favorites . Add ( branch ) ;
428
- Manager . LocalSettings . Set ( FavoritesSetting , favorites . Select ( x => x . Name ) . ToList ( ) ) ;
429
- }
430
- }
431
-
432
349
private void OnButtonBarGUI ( )
433
350
{
434
351
if ( mode == BranchesMode . Default )
@@ -568,7 +485,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
568
485
var style = node . Active ? Styles . BoldLabel : Styles . Label ;
569
486
var rect = GUILayoutUtility . GetRect ( content , style , GUILayout . MaxHeight ( EditorGUIUtility . singleLineHeight ) ) ;
570
487
var clickRect = new Rect ( 0f , rect . y , Position . width , rect . height ) ;
571
- var favoriteRect = new Rect ( clickRect . xMax - clickRect . height * 2f , clickRect . y , clickRect . height , clickRect . height ) ;
572
488
573
489
var selected = selectedNode == node ;
574
490
var keyboardFocus = GUIUtility . keyboardControl == listID ;
@@ -580,25 +496,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
580
496
{
581
497
style . Draw ( clickRect , GUIContent . none , false , false , true , keyboardFocus ) ;
582
498
}
583
-
584
- if ( node . Type != NodeType . Folder )
585
- {
586
- var favorite = IsFavorite ( node . Name ) ;
587
- if ( Event . current . type == EventType . Repaint )
588
- {
589
- GUI . DrawTexture ( favoriteRect , favorite ? Styles . FavoriteIconOn : Styles . FavoriteIconOff ) ;
590
- }
591
- else if ( Event . current . type == EventType . MouseDown && favoriteRect . Contains ( Event . current . mousePosition ) )
592
- {
593
- SetFavorite ( node , ! favorite ) ;
594
- Event . current . Use ( ) ;
595
- }
596
- }
597
- }
598
- // Favorite status
599
- else if ( Event . current . type == EventType . Repaint && node . Type != NodeType . Folder && IsFavorite ( node . Name ) )
600
- {
601
- GUI . DrawTexture ( favoriteRect , Styles . FavoriteIconOn ) ;
602
499
}
603
500
604
501
// The actual icon and label
0 commit comments