@@ -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
public override void OnRepositoryChanged ( IRepository oldRepository )
@@ -158,28 +147,6 @@ public void OnEmbeddedGUI()
158
147
159
148
GUILayout . BeginVertical ( Styles . CommitFileAreaStyle ) ;
160
149
{
161
- // Favorites list
162
- if ( favorites . Count > 0 )
163
- {
164
- GUILayout . Label ( FavoritesTitle ) ;
165
- GUILayout . BeginHorizontal ( ) ;
166
- {
167
- GUILayout . BeginVertical ( ) ;
168
- {
169
- for ( var index = 0 ; index < favorites . Count ; ++ index )
170
- {
171
- OnTreeNodeGUI ( favorites [ index ] ) ;
172
- }
173
- }
174
-
175
- GUILayout . EndVertical ( ) ;
176
- }
177
-
178
- GUILayout . EndHorizontal ( ) ;
179
-
180
- GUILayout . Space ( Styles . BranchListSeperation ) ;
181
- }
182
-
183
150
// Local branches and "create branch" button
184
151
showLocalBranches = EditorGUILayout . Foldout ( showLocalBranches , LocalTitle ) ;
185
152
if ( showLocalBranches )
@@ -262,16 +229,6 @@ public void OnEmbeddedGUI()
262
229
263
230
private int CompareBranches ( GitBranch a , GitBranch b )
264
231
{
265
- if ( IsFavorite ( a . Name ) )
266
- {
267
- return - 1 ;
268
- }
269
-
270
- if ( IsFavorite ( b . Name ) )
271
- {
272
- return 1 ;
273
- }
274
-
275
232
if ( a . Name . Equals ( "master" ) )
276
233
{
277
234
return - 1 ;
@@ -285,11 +242,6 @@ private int CompareBranches(GitBranch a, GitBranch b)
285
242
return 0 ;
286
243
}
287
244
288
- private bool IsFavorite ( string branchName )
289
- {
290
- return ! String . IsNullOrEmpty ( branchName ) && favoritesList . Contains ( branchName ) ;
291
- }
292
-
293
245
private void BuildTree ( IEnumerable < GitBranch > local , IEnumerable < GitBranch > remote )
294
246
{
295
247
//Clear the selected node
@@ -305,9 +257,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
305
257
var tracking = new List < KeyValuePair < int , int > > ( ) ;
306
258
var localBranchNodes = new List < BranchTreeNode > ( ) ;
307
259
308
- // Prepare for updated favorites listing
309
- favorites . Clear ( ) ;
310
-
311
260
// Just build directly on the local root, keep track of active branch
312
261
localRoot = new BranchTreeNode ( "" , NodeType . Folder , false ) ;
313
262
for ( var index = 0 ; index < localBranches . Count ; ++ index )
@@ -335,12 +284,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
335
284
}
336
285
}
337
286
338
- // Add to favorites
339
- if ( favoritesList . Contains ( branch . Name ) )
340
- {
341
- favorites . Add ( node ) ;
342
- }
343
-
344
287
// Build into tree
345
288
BuildTree ( localRoot , node ) ;
346
289
}
@@ -379,12 +322,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
379
322
}
380
323
}
381
324
382
- // Add to favorites
383
- if ( favoritesList . Contains ( branch . Name ) )
384
- {
385
- favorites . Add ( node ) ;
386
- }
387
-
388
325
// Build on the root of the remote, just like with locals
389
326
BuildTree ( remotes [ remoteIndex ] . Root , node ) ;
390
327
}
@@ -417,26 +354,6 @@ private void BuildTree(BranchTreeNode parent, BranchTreeNode child)
417
354
BuildTree ( folder , child ) ;
418
355
}
419
356
420
- private void SetFavorite ( BranchTreeNode branch , bool favorite )
421
- {
422
- if ( string . IsNullOrEmpty ( branch . Name ) )
423
- {
424
- return ;
425
- }
426
-
427
- if ( ! favorite )
428
- {
429
- favorites . Remove ( branch ) ;
430
- Manager . LocalSettings . Set ( FavoritesSetting , favorites . Select ( x => x . Name ) . ToList ( ) ) ;
431
- }
432
- else
433
- {
434
- favorites . Remove ( branch ) ;
435
- favorites . Add ( branch ) ;
436
- Manager . LocalSettings . Set ( FavoritesSetting , favorites . Select ( x => x . Name ) . ToList ( ) ) ;
437
- }
438
- }
439
-
440
357
private void OnButtonBarGUI ( )
441
358
{
442
359
if ( mode == BranchesMode . Default )
@@ -576,7 +493,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
576
493
var style = node . Active ? Styles . BoldLabel : Styles . Label ;
577
494
var rect = GUILayoutUtility . GetRect ( content , style , GUILayout . MaxHeight ( EditorGUIUtility . singleLineHeight ) ) ;
578
495
var clickRect = new Rect ( 0f , rect . y , Position . width , rect . height ) ;
579
- var favoriteRect = new Rect ( clickRect . xMax - clickRect . height * 2f , clickRect . y , clickRect . height , clickRect . height ) ;
580
496
581
497
var selected = selectedNode == node ;
582
498
var keyboardFocus = GUIUtility . keyboardControl == listID ;
@@ -588,25 +504,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
588
504
{
589
505
style . Draw ( clickRect , GUIContent . none , false , false , true , keyboardFocus ) ;
590
506
}
591
-
592
- if ( node . Type != NodeType . Folder )
593
- {
594
- var favorite = IsFavorite ( node . Name ) ;
595
- if ( Event . current . type == EventType . Repaint )
596
- {
597
- GUI . DrawTexture ( favoriteRect , favorite ? Styles . FavoriteIconOn : Styles . FavoriteIconOff ) ;
598
- }
599
- else if ( Event . current . type == EventType . MouseDown && favoriteRect . Contains ( Event . current . mousePosition ) )
600
- {
601
- SetFavorite ( node , ! favorite ) ;
602
- Event . current . Use ( ) ;
603
- }
604
- }
605
- }
606
- // Favorite status
607
- else if ( Event . current . type == EventType . Repaint && node . Type != NodeType . Folder && IsFavorite ( node . Name ) )
608
- {
609
- GUI . DrawTexture ( favoriteRect , Styles . FavoriteIconOn ) ;
610
507
}
611
508
612
509
// The actual icon and label
0 commit comments