@@ -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 public override void OnRepositoryChanged ( IRepository oldRepository )
@@ -158,28 +147,6 @@ public void OnEmbeddedGUI()
158147
159148 GUILayout . BeginVertical ( Styles . CommitFileAreaStyle ) ;
160149 {
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-
183150 // Local branches and "create branch" button
184151 showLocalBranches = EditorGUILayout . Foldout ( showLocalBranches , LocalTitle ) ;
185152 if ( showLocalBranches )
@@ -262,16 +229,6 @@ public void OnEmbeddedGUI()
262229
263230 private int CompareBranches ( GitBranch a , GitBranch b )
264231 {
265- if ( IsFavorite ( a . Name ) )
266- {
267- return - 1 ;
268- }
269-
270- if ( IsFavorite ( b . Name ) )
271- {
272- return 1 ;
273- }
274-
275232 if ( a . Name . Equals ( "master" ) )
276233 {
277234 return - 1 ;
@@ -285,11 +242,6 @@ private int CompareBranches(GitBranch a, GitBranch b)
285242 return 0 ;
286243 }
287244
288- private bool IsFavorite ( string branchName )
289- {
290- return ! String . IsNullOrEmpty ( branchName ) && favoritesList . Contains ( branchName ) ;
291- }
292-
293245 private void BuildTree ( IEnumerable < GitBranch > local , IEnumerable < GitBranch > remote )
294246 {
295247 //Clear the selected node
@@ -305,9 +257,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
305257 var tracking = new List < KeyValuePair < int , int > > ( ) ;
306258 var localBranchNodes = new List < BranchTreeNode > ( ) ;
307259
308- // Prepare for updated favorites listing
309- favorites . Clear ( ) ;
310-
311260 // Just build directly on the local root, keep track of active branch
312261 localRoot = new BranchTreeNode ( "" , NodeType . Folder , false ) ;
313262 for ( var index = 0 ; index < localBranches . Count ; ++ index )
@@ -335,12 +284,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
335284 }
336285 }
337286
338- // Add to favorites
339- if ( favoritesList . Contains ( branch . Name ) )
340- {
341- favorites . Add ( node ) ;
342- }
343-
344287 // Build into tree
345288 BuildTree ( localRoot , node ) ;
346289 }
@@ -379,12 +322,6 @@ private void BuildTree(IEnumerable<GitBranch> local, IEnumerable<GitBranch> remo
379322 }
380323 }
381324
382- // Add to favorites
383- if ( favoritesList . Contains ( branch . Name ) )
384- {
385- favorites . Add ( node ) ;
386- }
387-
388325 // Build on the root of the remote, just like with locals
389326 BuildTree ( remotes [ remoteIndex ] . Root , node ) ;
390327 }
@@ -417,26 +354,6 @@ private void BuildTree(BranchTreeNode parent, BranchTreeNode child)
417354 BuildTree ( folder , child ) ;
418355 }
419356
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-
440357 private void OnButtonBarGUI ( )
441358 {
442359 if ( mode == BranchesMode . Default )
@@ -576,7 +493,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
576493 var style = node . Active ? Styles . BoldLabel : Styles . Label ;
577494 var rect = GUILayoutUtility . GetRect ( content , style , GUILayout . MaxHeight ( EditorGUIUtility . singleLineHeight ) ) ;
578495 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 ) ;
580496
581497 var selected = selectedNode == node ;
582498 var keyboardFocus = GUIUtility . keyboardControl == listID ;
@@ -588,25 +504,6 @@ private void OnTreeNodeGUI(BranchTreeNode node)
588504 {
589505 style . Draw ( clickRect , GUIContent . none , false , false , true , keyboardFocus ) ;
590506 }
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 ) ;
610507 }
611508
612509 // The actual icon and label
0 commit comments