From 3ada98c765e0d161c1e0892b7d8824da53fe9972 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Thu, 19 May 2011 18:09:01 +0200 Subject: [PATCH 1/5] Use of stringWithFormat in this situation is overkill. --- PBGitCommitController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 6ea4c95..75e79e6 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -170,7 +170,7 @@ { [commitMessageView setEditable:YES]; [commitMessageView setString:@""]; - [webController setStateMessage:[NSString stringWithFormat:[[notification userInfo] objectForKey:@"description"]]]; + [webController setStateMessage:[NSString stringWithString:[[notification userInfo] objectForKey:@"description"]]]; [repository reloadRefs]; } From a56f82ac2ca493ff3b3fc78d98edc1a56a6ee780 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Thu, 19 May 2011 18:16:02 +0200 Subject: [PATCH 2/5] Ugly coupling with mis-use of delegate is ugly. --- PBFileChangesTableView.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PBFileChangesTableView.m b/PBFileChangesTableView.m index f2ea75d..c0707f0 100644 --- a/PBFileChangesTableView.m +++ b/PBFileChangesTableView.m @@ -18,7 +18,8 @@ NSPoint eventLocation = [self convertPoint: [theEvent locationInWindow] fromView: nil]; NSInteger rowIndex = [self rowAtPoint:eventLocation]; [self selectRowIndexes:[NSIndexSet indexSetWithIndex:rowIndex] byExtendingSelection:TRUE]; - return [[self delegate] menuForTable: self]; + // TODO: Fix the coupling so we don't need the cast (at least). + return [(PBGitIndexController*)[self delegate] menuForTable: self]; } return nil; From b71e1ca0f0d4f9e0c96ccd9aa66bd724262be2ca Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Thu, 19 May 2011 18:16:17 +0200 Subject: [PATCH 3/5] Explicit cast is needed if we abuse the delegate that way. --- PBSourceViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBSourceViewCell.m b/PBSourceViewCell.m index 2c9fd5a..1f2f809 100644 --- a/PBSourceViewCell.m +++ b/PBSourceViewCell.m @@ -33,7 +33,7 @@ NSPoint point = [self.controlView convertPoint:[event locationInWindow] fromView:nil]; NSInteger row = [view rowAtPoint:point]; - PBGitSidebarController *controller = [view delegate]; + PBGitSidebarController *controller = (PBGitSidebarController*)[view delegate]; return [controller menuForRow:row]; } From 7f281498f038366b8582df3a0b3c7d0bf5c86b38 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Thu, 19 May 2011 18:15:28 +0200 Subject: [PATCH 4/5] Add missing message declaration in header file. Use specific type instead of id. --- PBGitRepository.h | 1 + PBWebController.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PBGitRepository.h b/PBGitRepository.h index fe5369d..7e4cd6f 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -88,6 +88,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) { - (NSFileHandle*) handleForCommand:(NSString*) cmd; - (NSFileHandle*) handleForArguments:(NSArray*) args; +- (NSFileHandle*) handleInWorkDirForArguments:(NSArray *)args; - (NSFileHandle *) handleInWorkDirForArguments:(NSArray *)args; - (NSString*) outputForCommand:(NSString*) cmd; - (NSString *)outputForCommand:(NSString *)str retValue:(int *)ret; diff --git a/PBWebController.h b/PBWebController.h index 4aa30d9..4582230 100644 --- a/PBWebController.h +++ b/PBWebController.h @@ -9,6 +9,8 @@ #import #import +#import "PBGitRepository.h" + @interface PBWebController : NSObject { IBOutlet WebView* view; NSString *startFile; @@ -18,11 +20,11 @@ NSMapTable *callbacks; // For the repository access - IBOutlet id repository; + IBOutlet PBGitRepository *repository; } @property (retain) NSString *startFile; -@property (retain) id repository; +@property (retain) PBGitRepository *repository; - (WebScriptObject *) script; - (void) closeView; From c1b3658e056e8f2c40a289cc1945864c26d6548c Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Thu, 19 May 2011 18:22:02 +0200 Subject: [PATCH 5/5] Explicit cast to remove warning. --- PBWebHistoryController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index d6ea41c..a05bfe8 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -122,7 +122,7 @@ [[view windowScriptObject] callWebScriptMethod:@"showCommit" withArguments:[NSArray arrayWithObject:html]]; #ifdef DEBUG_BUILD - NSString *dom=[[[[view mainFrame] DOMDocument] documentElement] outerHTML]; + NSString *dom=[(DOMHTMLElement*)[[[view mainFrame] DOMDocument] documentElement] outerHTML]; NSString *tmpFile=@"~/tmp/test2.html"; [dom writeToFile:[tmpFile stringByExpandingTildeInPath] atomically:true encoding:NSUTF8StringEncoding error:nil]; #endif