This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ class DirectoryView extends HTMLElement
5252 else
5353 @draggable = true
5454 @subscriptions .add @directory .onDidStatusChange => @ updateStatus ()
55+ @subscriptions .add @directory .onDidIconStatusChange (iconStatus) =>
56+ @ updateIconStatus (iconStatus)
5557 @ updateStatus ()
5658
5759 @ expand () if @directory .expansionState .isExpanded
@@ -60,6 +62,12 @@ class DirectoryView extends HTMLElement
6062 @classList .remove (' status-ignored' , ' status-modified' , ' status-added' )
6163 @classList .add (" status-#{ @directory .status } " ) if @directory .status ?
6264
65+ updateIconStatus : (newIconStatus ) ->
66+ if newIconStatus isnt @iconStatus and @iconStatus
67+ @classList .remove (@iconStatus )
68+ @classList .add (newIconStatus) if newIconStatus
69+ @iconStatus = newIconStatus
70+
6371 subscribeToDirectory : ->
6472 @subscriptions .add @directory .onDidAddEntries (addedEntries) =>
6573 return unless @isExpanded
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ class Directory
4848 onDidStatusChange : (callback ) ->
4949 @emitter .on (' did-status-change' , callback)
5050
51+ onDidIconStatusChange : (callback ) ->
52+ @emitter .on (' did-icon-status-change' , callback)
53+
5154 onDidAddEntries : (callback ) ->
5255 @emitter .on (' did-add-entries' , callback)
5356
@@ -91,6 +94,11 @@ class Directory
9194 @status = newStatus
9295 @emitter .emit (' did-status-change' , newStatus)
9396
97+ updateIconStatus : (newIconStatus ) ->
98+ if newIconStatus isnt @iconStatus
99+ @iconStatus = newIconStatus
100+ @emitter .emit (' did-icon-status-change' , newIconStatus)
101+
94102 # Is the given path ignored?
95103 isPathIgnored : (filePath ) ->
96104 if atom .config .get (' tree-view.hideVcsIgnoredFiles' )
Original file line number Diff line number Diff line change @@ -22,12 +22,19 @@ class FileView extends HTMLElement
2222 @fileName .classList .add (FileIcons .getService ().iconClassForPath (@file .path ))
2323
2424 @subscriptions .add @file .onDidStatusChange => @ updateStatus ()
25+ @subscriptions .add @file .onDidIconStatusChange (iconStatus) => @ updateIconStatus (iconStatus)
2526 @ updateStatus ()
2627
2728 updateStatus : ->
2829 @classList .remove (' status-ignored' , ' status-modified' , ' status-added' )
2930 @classList .add (" status-#{ @file .status } " ) if @file .status ?
3031
32+ updateIconStatus : (newIconStatus ) ->
33+ if newIconStatus isnt @iconStatus and @iconStatus
34+ @classList .remove (@iconStatus )
35+ @classList .add (newIconStatus) if newIconStatus
36+ @iconStatus = newIconStatus
37+
3138 getPath : ->
3239 @fileName .dataset .path
3340
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class File
3333 onDidStatusChange : (callback ) ->
3434 @emitter .on (' did-status-change' , callback)
3535
36+ onDidIconStatusChange : (callback ) ->
37+ @emitter .on (' did-icon-status-change' , callback)
38+
3639 # Subscribe to the project' repo for changes to the Git status of this file.
3740 subscribeToRepo : ->
3841 repo = repoForPath (@path )
@@ -62,5 +65,10 @@ class File
6265 @status = newStatus
6366 @emitter .emit (' did-status-change' , newStatus)
6467
68+ updateIconStatus : (newIconStatus ) ->
69+ if newIconStatus isnt @iconStatus
70+ @iconStatus = newIconStatus
71+ @emitter .emit (' did-icon-status-change' , newIconStatus)
72+
6573 isPathEqual : (pathToCompare ) ->
6674 @path is pathToCompare or @realPath is pathToCompare
You can’t perform that action at this time.
0 commit comments