From 5b54605822aaf6b73a0f5a62056fd0e6f36dbcb1 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 10 Jan 2008 16:46:15 +0000 Subject: [PATCH] eliminate some redundant open methods --- macosx/Controller.h | 1 - macosx/Controller.m | 25 +++++++------------------ macosx/InfoWindowController.m | 1 + 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index e0c1fa6e6..3df18f3ef 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -118,7 +118,6 @@ typedef enum BOOL fRemoteQuit; } -- (void) openFiles: (NSArray *) filenames; - (void) openFiles: (NSArray *) filenames addType: (addType) type forcePath: (NSString *) path; - (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add; - (void) openCreatedFile: (NSNotification *) notification; diff --git a/macosx/Controller.m b/macosx/Controller.m index 846c030a4..e15856a62 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -865,12 +865,9 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi //called on by applescript - (void) open: (NSArray *) files { - [self performSelectorOnMainThread: @selector(openFiles:) withObject: files waitUntilDone: NO]; -} - -- (void) openFiles: (NSArray *) filenames -{ - [self openFiles: filenames addType: ADD_NORMAL forcePath: nil]; + NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: files, @"Filenames", + [NSNumber numberWithInt: ADD_NORMAL], @"AddType", nil]; + [self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dict waitUntilDone: NO]; } - (void) openShowSheet: (id) sender @@ -891,19 +888,11 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi if (code == NSOKButton) { NSDictionary * dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: - [panel filenames], @"Files", useOptions, @"UseOptions", nil]; - [self performSelectorOnMainThread: @selector(openFromSheet:) withObject: dictionary waitUntilDone: NO]; + [panel filenames], @"Files", [useOptions boolValue] ? ADD_SHOW_OPTIONS : ADD_NORMAL, @"UseOptions", nil]; + [self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dictionary waitUntilDone: NO]; } } -- (void) openFromSheet: (NSDictionary *) dictionary -{ - [self openFiles: [dictionary objectForKey: @"Files"] addType: [[dictionary objectForKey: @"UseOptions"] boolValue] - ? ADD_SHOW_OPTIONS : ADD_NORMAL forcePath: nil]; - - [dictionary release]; -} - - (void) duplicateOpenAlert: (NSString *) name { if (![fDefaults boolForKey: @"WarningDuplicate"]) @@ -2380,7 +2369,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi case TR_OK: if (!ask) count = [fTorrents count]; - [self openFiles: [NSArray arrayWithObject: file]]; + [self openFiles: [NSArray arrayWithObject: file] addType: ADD_NORMAL forcePath: nil]; //check if torrent was opened if (!ask && [fTorrents count] > count) @@ -3875,7 +3864,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi { int oldCount = [fTorrents count]; - [self openFiles: torrents]; + [self openFiles: torrents addType: ADD_NORMAL forcePath: nil]; return [fTorrents count] > oldCount; } diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 2d7b700a3..12073b77c 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -759,6 +759,7 @@ typedef enum break; } + #warning redo NSMutableArray * peerStatusArray = [NSMutableArray arrayWithCapacity: 2]; if ([[peer objectForKey: @"PeerChoked"] boolValue]) [peerStatusArray addObject: NSLocalizedString(@"Refusing to send data to peer", "Inspector -> peer -> status")];