13
13
14
14
#define FileChangesTableViewType @" GitFileChangedType"
15
15
16
+ @interface PBGitIndexController ()
17
+ - (void )discardChangesForFiles : (NSArray *)files force : (BOOL )force ;
18
+ @end
19
+
16
20
@implementation PBGitIndexController
17
21
18
22
- (void )awakeFromNib
@@ -27,7 +31,8 @@ - (void)awakeFromNib
27
31
[stagedTable registerForDraggedTypes: [NSArray arrayWithObject: FileChangesTableViewType]];
28
32
}
29
33
30
- - (void ) ignoreFiles : (NSArray *)files
34
+ // FIXME: Find a proper place for this method -- this is not it.
35
+ - (void )ignoreFiles : (NSArray *)files
31
36
{
32
37
// Build output string
33
38
NSMutableArray *fileList = [NSMutableArray array ];
@@ -62,26 +67,6 @@ - (void) ignoreFiles:(NSArray *)files
62
67
[ignoreFile writeToFile: gitIgnoreName atomically: YES encoding: enc error: &error];
63
68
if (error)
64
69
[[commitController.repository windowController ] showErrorSheet: error];
65
-
66
- // TODO: Post index change
67
- }
68
-
69
- # pragma mark Displaying diffs
70
-
71
-
72
- - (void )discardChangesForFiles : (NSArray *)files force : (BOOL )force
73
- {
74
- if (!force) {
75
- int ret = [[NSAlert alertWithMessageText: @" Discard changes"
76
- defaultButton: nil
77
- alternateButton: @" Cancel"
78
- otherButton: nil
79
- informativeTextWithFormat: @" Are you sure you wish to discard the changes to this file?\n\n You cannot undo this operation." ] runModal ];
80
- if (ret != NSAlertDefaultReturn )
81
- return ;
82
- }
83
-
84
- [commitController.index discardChangesForFiles: files];
85
70
}
86
71
87
72
# pragma mark Context Menu methods
@@ -179,10 +164,11 @@ - (void) openFilesAction:(id) sender
179
164
- (void ) ignoreFilesAction : (id ) sender
180
165
{
181
166
NSArray *selectedFiles = [sender representedObject ];
182
- if ([selectedFiles count ] > 0 ) {
183
- [self ignoreFiles: selectedFiles];
184
- }
185
- [commitController refresh: NULL ];
167
+ if ([selectedFiles count ] == 0 )
168
+ return ;
169
+
170
+ [self ignoreFiles: selectedFiles];
171
+ [commitController.index refresh ];
186
172
}
187
173
188
174
- (void )discardFilesAction : (id ) sender
@@ -210,6 +196,20 @@ - (void) showInFinderAction:(id) sender
210
196
[ws selectFile: path inFileViewerRootedAtPath: nil ];
211
197
}
212
198
199
+ - (void )discardChangesForFiles : (NSArray *)files force : (BOOL )force
200
+ {
201
+ if (!force) {
202
+ int ret = [[NSAlert alertWithMessageText: @" Discard changes"
203
+ defaultButton: nil
204
+ alternateButton: @" Cancel"
205
+ otherButton: nil
206
+ informativeTextWithFormat: @" Are you sure you wish to discard the changes to this file?\n\n You cannot undo this operation." ] runModal ];
207
+ if (ret != NSAlertDefaultReturn )
208
+ return ;
209
+ }
210
+
211
+ [commitController.index discardChangesForFiles: files];
212
+ }
213
213
214
214
# pragma mark TableView icon delegate
215
215
- (void )tableView : (NSTableView *)tableView willDisplayCell : (id )cell forTableColumn : (NSTableColumn *)tableColumn row : (NSInteger )rowIndex
@@ -294,11 +294,4 @@ - (BOOL)tableView:(NSTableView *)aTableView
294
294
return YES ;
295
295
}
296
296
297
- # pragma mark WebKit Accessibility
298
-
299
- + (BOOL )isSelectorExcludedFromWebScript : (SEL )aSelector
300
- {
301
- return NO ;
302
- }
303
-
304
297
@end
0 commit comments