This repository was archived by the owner on Dec 15, 2022. It is now read-only.
File tree 4 files changed +31
-0
lines changed
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
52
52
else
53
53
@draggable = true
54
54
@subscriptions .add @directory .onDidStatusChange => @ updateStatus ()
55
+ @subscriptions .add @directory .onDidIconStatusChange (iconStatus) =>
56
+ @ updateIconStatus (iconStatus)
55
57
@ updateStatus ()
56
58
57
59
@ expand () if @directory .expansionState .isExpanded
@@ -60,6 +62,12 @@ class DirectoryView extends HTMLElement
60
62
@classList .remove (' status-ignored' , ' status-modified' , ' status-added' )
61
63
@classList .add (" status-#{ @directory .status } " ) if @directory .status ?
62
64
65
+ updateIconStatus : (newIconStatus ) ->
66
+ if newIconStatus isnt @iconStatus and @iconStatus
67
+ @classList .remove (@iconStatus )
68
+ @classList .add (newIconStatus) if newIconStatus
69
+ @iconStatus = newIconStatus
70
+
63
71
subscribeToDirectory : ->
64
72
@subscriptions .add @directory .onDidAddEntries (addedEntries) =>
65
73
return unless @isExpanded
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ class Directory
48
48
onDidStatusChange : (callback ) ->
49
49
@emitter .on (' did-status-change' , callback)
50
50
51
+ onDidIconStatusChange : (callback ) ->
52
+ @emitter .on (' did-icon-status-change' , callback)
53
+
51
54
onDidAddEntries : (callback ) ->
52
55
@emitter .on (' did-add-entries' , callback)
53
56
@@ -91,6 +94,11 @@ class Directory
91
94
@status = newStatus
92
95
@emitter .emit (' did-status-change' , newStatus)
93
96
97
+ updateIconStatus : (newIconStatus ) ->
98
+ if newIconStatus isnt @iconStatus
99
+ @iconStatus = newIconStatus
100
+ @emitter .emit (' did-icon-status-change' , newIconStatus)
101
+
94
102
# Is the given path ignored?
95
103
isPathIgnored : (filePath ) ->
96
104
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
22
22
@fileName .classList .add (FileIcons .getService ().iconClassForPath (@file .path ))
23
23
24
24
@subscriptions .add @file .onDidStatusChange => @ updateStatus ()
25
+ @subscriptions .add @file .onDidIconStatusChange (iconStatus) => @ updateIconStatus (iconStatus)
25
26
@ updateStatus ()
26
27
27
28
updateStatus : ->
28
29
@classList .remove (' status-ignored' , ' status-modified' , ' status-added' )
29
30
@classList .add (" status-#{ @file .status } " ) if @file .status ?
30
31
32
+ updateIconStatus : (newIconStatus ) ->
33
+ if newIconStatus isnt @iconStatus and @iconStatus
34
+ @classList .remove (@iconStatus )
35
+ @classList .add (newIconStatus) if newIconStatus
36
+ @iconStatus = newIconStatus
37
+
31
38
getPath : ->
32
39
@fileName .dataset .path
33
40
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class File
33
33
onDidStatusChange : (callback ) ->
34
34
@emitter .on (' did-status-change' , callback)
35
35
36
+ onDidIconStatusChange : (callback ) ->
37
+ @emitter .on (' did-icon-status-change' , callback)
38
+
36
39
# Subscribe to the project' repo for changes to the Git status of this file.
37
40
subscribeToRepo : ->
38
41
repo = repoForPath (@path )
@@ -62,5 +65,10 @@ class File
62
65
@status = newStatus
63
66
@emitter .emit (' did-status-change' , newStatus)
64
67
68
+ updateIconStatus : (newIconStatus ) ->
69
+ if newIconStatus isnt @iconStatus
70
+ @iconStatus = newIconStatus
71
+ @emitter .emit (' did-icon-status-change' , newIconStatus)
72
+
65
73
isPathEqual : (pathToCompare ) ->
66
74
@path is pathToCompare or @realPath is pathToCompare
You can’t perform that action at this time.
0 commit comments