Skip to content

Commit 438a3f8

Browse files
committed
GitIndexController: reorder methods a bit, remove unnecessary stuff
1 parent 3dc312f commit 438a3f8

File tree

3 files changed

+25
-55
lines changed

3 files changed

+25
-55
lines changed

PBGitCommitView.xib

-20
Original file line numberDiff line numberDiff line change
@@ -1114,22 +1114,6 @@
11141114
</object>
11151115
<int key="connectionID">264</int>
11161116
</object>
1117-
<object class="IBConnectionRecord">
1118-
<object class="IBOutletConnection" key="connection">
1119-
<string key="label">stagedButtonCell</string>
1120-
<reference key="source" ref="446885874"/>
1121-
<reference key="destination" ref="39450212"/>
1122-
</object>
1123-
<int key="connectionID">265</int>
1124-
</object>
1125-
<object class="IBConnectionRecord">
1126-
<object class="IBOutletConnection" key="connection">
1127-
<string key="label">unstagedButtonCell</string>
1128-
<reference key="source" ref="446885874"/>
1129-
<reference key="destination" ref="45690317"/>
1130-
</object>
1131-
<int key="connectionID">266</int>
1132-
</object>
11331117
<object class="IBConnectionRecord">
11341118
<object class="IBActionConnection" key="connection">
11351119
<string key="label">rowClicked:</string>
@@ -1763,20 +1747,16 @@
17631747
<object class="NSMutableArray" key="dict.sortedKeys">
17641748
<bool key="EncodedWithXMLCoder">YES</bool>
17651749
<string>commitController</string>
1766-
<string>stagedButtonCell</string>
17671750
<string>stagedFilesController</string>
17681751
<string>stagedTable</string>
1769-
<string>unstagedButtonCell</string>
17701752
<string>unstagedFilesController</string>
17711753
<string>unstagedTable</string>
17721754
</object>
17731755
<object class="NSMutableArray" key="dict.values">
17741756
<bool key="EncodedWithXMLCoder">YES</bool>
17751757
<string>PBGitCommitController</string>
1776-
<string>PBIconAndTextCell</string>
17771758
<string>NSArrayController</string>
17781759
<string>NSTableView</string>
1779-
<string>PBIconAndTextCell</string>
17801760
<string>NSArrayController</string>
17811761
<string>NSTableView</string>
17821762
</object>

PBGitIndexController.h

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
IBOutlet NSArrayController *stagedFilesController, *unstagedFilesController;
1515
IBOutlet PBGitCommitController *commitController;
1616

17-
IBOutlet PBIconAndTextCell* unstagedButtonCell;
18-
IBOutlet PBIconAndTextCell* stagedButtonCell;
19-
2017
IBOutlet NSTableView *unstagedTable;
2118
IBOutlet NSTableView *stagedTable;
2219
}

PBGitIndexController.m

+25-32
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
#define FileChangesTableViewType @"GitFileChangedType"
1515

16+
@interface PBGitIndexController ()
17+
- (void)discardChangesForFiles:(NSArray *)files force:(BOOL)force;
18+
@end
19+
1620
@implementation PBGitIndexController
1721

1822
- (void)awakeFromNib
@@ -27,7 +31,8 @@ - (void)awakeFromNib
2731
[stagedTable registerForDraggedTypes: [NSArray arrayWithObject:FileChangesTableViewType]];
2832
}
2933

30-
- (void) ignoreFiles:(NSArray *)files
34+
// FIXME: Find a proper place for this method -- this is not it.
35+
- (void)ignoreFiles:(NSArray *)files
3136
{
3237
// Build output string
3338
NSMutableArray *fileList = [NSMutableArray array];
@@ -62,26 +67,6 @@ - (void) ignoreFiles:(NSArray *)files
6267
[ignoreFile writeToFile:gitIgnoreName atomically:YES encoding:enc error:&error];
6368
if (error)
6469
[[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\nYou cannot undo this operation."] runModal];
80-
if (ret != NSAlertDefaultReturn)
81-
return;
82-
}
83-
84-
[commitController.index discardChangesForFiles:files];
8570
}
8671

8772
# pragma mark Context Menu methods
@@ -179,10 +164,11 @@ - (void) openFilesAction:(id) sender
179164
- (void) ignoreFilesAction:(id) sender
180165
{
181166
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];
186172
}
187173

188174
- (void)discardFilesAction:(id) sender
@@ -210,6 +196,20 @@ - (void) showInFinderAction:(id) sender
210196
[ws selectFile: path inFileViewerRootedAtPath:nil];
211197
}
212198

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\nYou cannot undo this operation."] runModal];
207+
if (ret != NSAlertDefaultReturn)
208+
return;
209+
}
210+
211+
[commitController.index discardChangesForFiles:files];
212+
}
213213

214214
# pragma mark TableView icon delegate
215215
- (void)tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)rowIndex
@@ -294,11 +294,4 @@ - (BOOL)tableView:(NSTableView *)aTableView
294294
return YES;
295295
}
296296

297-
# pragma mark WebKit Accessibility
298-
299-
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
300-
{
301-
return NO;
302-
}
303-
304297
@end

0 commit comments

Comments
 (0)