@@ -24,8 +24,6 @@ class BranchesView : Subview
2424 private const string WarningCheckoutBranchExistsOK = "Ok" ;
2525 private const string NewBranchCancelButton = "x" ;
2626 private const string NewBranchConfirmButton = "Create" ;
27- private const string FavoritesSetting = "Favorites" ;
28- private const string FavoritesTitle = "Favorites" ;
2927 private const string CreateBranchTitle = "Create Branch" ;
3028 private const string LocalTitle = "Local branches" ;
3129 private const string RemoteTitle = "Remote branches" ;
@@ -38,11 +36,9 @@ class BranchesView : Subview
3836 private bool showLocalBranches = true ;
3937 private bool showRemoteBranches = true ;
4038
41- [ NonSerialized ] private List < BranchTreeNode > favorites = new List < BranchTreeNode > ( ) ;
4239 [ NonSerialized ] private int listID = - 1 ;
4340 [ NonSerialized ] private BranchTreeNode newNodeSelection ;
4441 [ NonSerialized ] private BranchesMode targetMode ;
45- [ NonSerialized ] private bool favoritesHasChanged ;
4642
4743 [ SerializeField ] private BranchTreeNode activeBranchNode ;
4844 [ SerializeField ] private BranchTreeNode localRoot ;
@@ -51,7 +47,6 @@ class BranchesView : Subview
5147 [ SerializeField ] private List < Remote > remotes = new List < Remote > ( ) ;
5248 [ SerializeField ] private Vector2 scroll ;
5349 [ SerializeField ] private BranchTreeNode selectedNode ;
54- [ SerializeField ] private List < string > favoritesList = new List < string > ( ) ;
5550
5651 public override void InitializeView ( IView parent )
5752 {
@@ -63,7 +58,6 @@ public override void OnEnable()
6358 {
6459 base . OnEnable ( ) ;
6560 AttachHandlers ( Repository ) ;
66- favoritesHasChanged = true ;
6761 Refresh ( ) ;
6862 }
6963
@@ -81,11 +75,6 @@ public override void OnDataUpdate()
8175
8276 private void MaybeUpdateData ( )
8377 {
84- if ( favoritesHasChanged )
85- {
86- favoritesList = Manager . LocalSettings . Get ( FavoritesSetting , new List < string > ( ) ) ;
87- favoritesHasChanged = false ;
88- }
8978 }
9079
9180 private void AttachHandlers ( IRepository repository )
@@ -150,28 +139,6 @@ public void OnEmbeddedGUI()
150139
151140 GUILayout . BeginVertical ( Styles . CommitFileAreaStyle ) ;
152141 {
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-
175142 // Local branches and "create branch" button
176143 showLocalBranches = EditorGUILayout . Foldout ( showLocalBranches , LocalTitle ) ;
177144 if ( showLocalBranches )
@@ -254,16 +221,6 @@ public void OnEmbeddedGUI()
254221
255222 private int CompareBranches ( GitBranch a , GitBranch b )
256223 {
257- if ( IsFavorite ( a . Name ) )
258- {
259- return - 1 ;
260- }
261-
262- if ( IsFavorite ( b . Name ) )
263- {
264- return 1 ;
265- }
266-
267224 if ( a . Name . Equals ( "master" ) )
268225 {
269226 return - 1 ;
@@ -277,11 +234,6 @@ private int CompareBranches(GitBranch a, GitBranch b)
277234 return 0 ;
278235 }
279236
280- private bool IsFavorite ( string branchName )
281- {
282- return ! String . IsNullOrEmpty ( branchName ) && favoritesList . Contains ( branchName ) ;
283- }
284-
285237 private void BuildTree ( IEnumerable < GitBranch > local , IEnumerable < GitBranch > remote )
286238 {
287239 //Clear the selected node
@@ -297,9 +249,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
297249 var tracking = new List < KeyValuePair < int , int > > ( ) ;
298250 var localBranchNodes = new List < BranchTreeNode > ( ) ;
299251
300- // Prepare for updated favorites listing
301- favorites . Clear ( ) ;
302-
303252 // Just build directly on the local root, keep track of active branch
304253 localRoot = new BranchTreeNode ( "" , NodeType . Folder , false ) ;
305254 for ( var index = 0 ; index < localBranches . Count ; ++ index )
@@ -327,12 +276,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
327276 }
328277 }
329278
330- // Add to favorites
331- if ( favoritesList . Contains ( branch . Name ) )
332- {
333- favorites . Add ( node ) ;
334- }
335-
336279 // Build into tree
337280 BuildTree ( localRoot , node ) ;
338281 }
@@ -371,12 +314,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
371314 }
372315 }
373316
374- // Add to favorites
375- if ( favoritesList . Contains ( branch . Name ) )
376- {
377- favorites . Add ( node ) ;
378- }
379-
380317 // Build on the root of the remote, just like with locals
381318 BuildTree ( remotes [ remoteIndex ] . Root , node ) ;
382319 }
@@ -409,26 +346,6 @@ private void BuildTree(BranchTreeNode parent, BranchTreeNode child)
409346 BuildTree ( folder , child ) ;
410347 }
411348
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-
432349 private void OnButtonBarGUI ( )
433350 {
434351 if ( mode == BranchesMode . Default )
@@ -568,7 +485,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
568485 var style = node . Active ? Styles . BoldLabel : Styles . Label ;
569486 var rect = GUILayoutUtility . GetRect ( content , style , GUILayout . MaxHeight ( EditorGUIUtility . singleLineHeight ) ) ;
570487 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 ) ;
572488
573489 var selected = selectedNode == node ;
574490 var keyboardFocus = GUIUtility . keyboardControl == listID ;
@@ -580,25 +496,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
580496 {
581497 style . Draw ( clickRect , GUIContent . none , false , false , true , keyboardFocus ) ;
582498 }
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 ) ;
602499 }
603500
604501 // The actual icon and label
0 commit comments