GitIndexController: reorder methods a bit, remove unnecessary stuff

This commit is contained in:
Pieter de Bie
2009-09-13 16:32:35 +02:00
parent 3dc312ff2e
commit 438a3f808d
3 changed files with 25 additions and 55 deletions
-20
View File
@@ -1114,22 +1114,6 @@
</object>
<int key="connectionID">264</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">stagedButtonCell</string>
<reference key="source" ref="446885874"/>
<reference key="destination" ref="39450212"/>
</object>
<int key="connectionID">265</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">unstagedButtonCell</string>
<reference key="source" ref="446885874"/>
<reference key="destination" ref="45690317"/>
</object>
<int key="connectionID">266</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">rowClicked:</string>
@@ -1763,20 +1747,16 @@
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>commitController</string>
<string>stagedButtonCell</string>
<string>stagedFilesController</string>
<string>stagedTable</string>
<string>unstagedButtonCell</string>
<string>unstagedFilesController</string>
<string>unstagedTable</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>PBGitCommitController</string>
<string>PBIconAndTextCell</string>
<string>NSArrayController</string>
<string>NSTableView</string>
<string>PBIconAndTextCell</string>
<string>NSArrayController</string>
<string>NSTableView</string>
</object>
-3
View File
@@ -14,9 +14,6 @@
IBOutlet NSArrayController *stagedFilesController, *unstagedFilesController;
IBOutlet PBGitCommitController *commitController;
IBOutlet PBIconAndTextCell* unstagedButtonCell;
IBOutlet PBIconAndTextCell* stagedButtonCell;
IBOutlet NSTableView *unstagedTable;
IBOutlet NSTableView *stagedTable;
}
+25 -32
View File
@@ -13,6 +13,10 @@
#define FileChangesTableViewType @"GitFileChangedType"
@interface PBGitIndexController ()
- (void)discardChangesForFiles:(NSArray *)files force:(BOOL)force;
@end
@implementation PBGitIndexController
- (void)awakeFromNib
@@ -27,7 +31,8 @@
[stagedTable registerForDraggedTypes: [NSArray arrayWithObject:FileChangesTableViewType]];
}
- (void) ignoreFiles:(NSArray *)files
// FIXME: Find a proper place for this method -- this is not it.
- (void)ignoreFiles:(NSArray *)files
{
// Build output string
NSMutableArray *fileList = [NSMutableArray array];
@@ -62,26 +67,6 @@
[ignoreFile writeToFile:gitIgnoreName atomically:YES encoding:enc error:&error];
if (error)
[[commitController.repository windowController] showErrorSheet:error];
// TODO: Post index change
}
# pragma mark Displaying diffs
- (void)discardChangesForFiles:(NSArray *)files force:(BOOL)force
{
if (!force) {
int ret = [[NSAlert alertWithMessageText:@"Discard changes"
defaultButton:nil
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@"Are you sure you wish to discard the changes to this file?\n\nYou cannot undo this operation."] runModal];
if (ret != NSAlertDefaultReturn)
return;
}
[commitController.index discardChangesForFiles:files];
}
# pragma mark Context Menu methods
@@ -179,10 +164,11 @@
- (void) ignoreFilesAction:(id) sender
{
NSArray *selectedFiles = [sender representedObject];
if ([selectedFiles count] > 0) {
[self ignoreFiles:selectedFiles];
}
[commitController refresh:NULL];
if ([selectedFiles count] == 0)
return;
[self ignoreFiles:selectedFiles];
[commitController.index refresh];
}
- (void)discardFilesAction:(id) sender
@@ -210,6 +196,20 @@
[ws selectFile: path inFileViewerRootedAtPath:nil];
}
- (void)discardChangesForFiles:(NSArray *)files force:(BOOL)force
{
if (!force) {
int ret = [[NSAlert alertWithMessageText:@"Discard changes"
defaultButton:nil
alternateButton:@"Cancel"
otherButton:nil
informativeTextWithFormat:@"Are you sure you wish to discard the changes to this file?\n\nYou cannot undo this operation."] runModal];
if (ret != NSAlertDefaultReturn)
return;
}
[commitController.index discardChangesForFiles:files];
}
# pragma mark TableView icon delegate
- (void)tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)rowIndex
@@ -294,11 +294,4 @@ writeRowsWithIndexes:(NSIndexSet *)rowIndexes
return YES;
}
# pragma mark WebKit Accessibility
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
return NO;
}
@end