Permalink
Browse files

GitIndexController: reorder methods a bit, remove unnecessary stuff

  • Loading branch information...
1 parent 3dc312f commit 438a3f808dede8589d47ea36f695727522d8b6dc @pieter committed Sep 13, 2009
Showing with 25 additions and 55 deletions.
  1. +0 −20 PBGitCommitView.xib
  2. +0 −3 PBGitIndexController.h
  3. +25 −32 PBGitIndexController.m
View
@@ -1115,22 +1115,6 @@
<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>
<reference key="source" ref="446885874"/>
@@ -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>
View
@@ -14,9 +14,6 @@
IBOutlet NSArrayController *stagedFilesController, *unstagedFilesController;
IBOutlet PBGitCommitController *commitController;
- IBOutlet PBIconAndTextCell* unstagedButtonCell;
- IBOutlet PBIconAndTextCell* stagedButtonCell;
-
IBOutlet NSTableView *unstagedTable;
IBOutlet NSTableView *stagedTable;
}
View
@@ -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 @@ - (void)awakeFromNib
[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 @@ - (void) ignoreFiles:(NSArray *)files
[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) openFilesAction:(id) sender
- (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 @@ - (void) showInFinderAction:(id) sender
[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 @@ - (BOOL)tableView:(NSTableView *)aTableView
return YES;
}
-# pragma mark WebKit Accessibility
-
-+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
-{
- return NO;
-}
-
@end

0 comments on commit 438a3f8

Please sign in to comment.