From 438a3f808dede8589d47ea36f695727522d8b6dc Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sun, 13 Sep 2009 16:32:35 +0200 Subject: [PATCH] GitIndexController: reorder methods a bit, remove unnecessary stuff --- PBGitCommitView.xib | 20 --------------- PBGitIndexController.h | 3 --- PBGitIndexController.m | 57 ++++++++++++++++++------------------------ 3 files changed, 25 insertions(+), 55 deletions(-) diff --git a/PBGitCommitView.xib b/PBGitCommitView.xib index 49beeb5..5b8021f 100644 --- a/PBGitCommitView.xib +++ b/PBGitCommitView.xib @@ -1114,22 +1114,6 @@ 264 - - - stagedButtonCell - - - - 265 - - - - unstagedButtonCell - - - - 266 - rowClicked: @@ -1763,20 +1747,16 @@ YES commitController - stagedButtonCell stagedFilesController stagedTable - unstagedButtonCell unstagedFilesController unstagedTable YES PBGitCommitController - PBIconAndTextCell NSArrayController NSTableView - PBIconAndTextCell NSArrayController NSTableView diff --git a/PBGitIndexController.h b/PBGitIndexController.h index 4bd969f..1a455e6 100644 --- a/PBGitIndexController.h +++ b/PBGitIndexController.h @@ -14,9 +14,6 @@ IBOutlet NSArrayController *stagedFilesController, *unstagedFilesController; IBOutlet PBGitCommitController *commitController; - IBOutlet PBIconAndTextCell* unstagedButtonCell; - IBOutlet PBIconAndTextCell* stagedButtonCell; - IBOutlet NSTableView *unstagedTable; IBOutlet NSTableView *stagedTable; } diff --git a/PBGitIndexController.m b/PBGitIndexController.m index a19c6b9..5d2a949 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -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