diff --git a/macosx/Controller.h b/macosx/Controller.h index 001cf1d54..2fcf6a971 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -89,12 +89,12 @@ - (NSArray *) torrentsAtIndexes: (NSIndexSet *) indexSet; - (void) torrentNumberChanged; -- (void) resumeTorrent: (id) sender; +- (void) resumeSelectedTorrents: (id) sender; - (void) resumeAllTorrents: (id) sender; -- (void) resumeTorrentWithIndex: (NSIndexSet *) indexSet; -- (void) stopTorrent: (id) sender; +- (void) resumeTorrents: (NSArray *) torrents; +- (void) stopSelectedTorrents: (id) sender; - (void) stopAllTorrents: (id) sender; -- (void) stopTorrentWithIndex: (NSIndexSet *) indexSet; +- (void) stopTorrents: (NSArray *) torrents; - (void) removeWithIndex: (NSIndexSet *) indexSet deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteData; diff --git a/macosx/Controller.m b/macosx/Controller.m index 240326e58..89669dcfe 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -486,50 +486,44 @@ static void sleepCallBack(void * controller, io_service_t y, [self application: NSApp openFiles: filenames]; } -- (void) resumeTorrent: (id) sender +- (void) resumeSelectedTorrents: (id) sender { - [self resumeTorrentWithIndex: [fTableView selectedRowIndexes]]; + [self resumeTorrents: [self torrentsAtIndexes: [fTableView selectedRowIndexes]]]; } - (void) resumeAllTorrents: (id) sender { - [self resumeTorrentWithIndex: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrents count])]]; + [self resumeTorrents: fTorrents]; } -- (void) resumeTorrentWithIndex: (NSIndexSet *) indexSet +- (void) resumeTorrents: (NSArray *) torrents; { - unsigned int i; - for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) - [[fTorrents objectAtIndex: i] startTransfer]; + [torrents makeObjectsPerformSelector: @selector(startTransfer)]; [self updateUI: nil]; [fInfoController updateInfoStatsAndSettings]; [self updateTorrentHistory]; } -- (void) stopTorrent: (id) sender +- (void) stopSelectedTorrents: (id) sender { - [self stopTorrentWithIndex: [fTableView selectedRowIndexes]]; + [self stopTorrents: [self torrentsAtIndexes: [fTableView selectedRowIndexes]]]; } - (void) stopAllTorrents: (id) sender { - [self stopTorrentWithIndex: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrents count])]]; + [self stopTorrents: fTorrents]; } -- (void) stopTorrentWithIndex: (NSIndexSet *) indexSet +- (void) stopTorrents: (NSArray *) torrents; { //don't want any of these starting then stopping - unsigned int i; + NSEnumerator * enumerator = [torrents objectEnumerator]; Torrent * torrent; - for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) - { - torrent = [fTorrents objectAtIndex: i]; + while ((torrent = [enumerator nextObject])) [torrent setWaitToStart: NO]; - } - for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) - [[fTorrents objectAtIndex: i] stopTransfer]; + [torrents makeObjectsPerformSelector: @selector(stopTransfer)]; [self updateUI: nil]; [fInfoController updateInfoStatsAndSettings]; @@ -1443,7 +1437,7 @@ static void sleepCallBack(void * controller, io_service_t y, [item setToolTip: @"Pause selected transfers"]; [item setImage: [NSImage imageNamed: @"PauseSelected.png"]]; [item setTarget: self]; - [item setAction: @selector(stopTorrent:)]; + [item setAction: @selector(stopSelectedTorrents:)]; } else if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED]) { @@ -1452,7 +1446,7 @@ static void sleepCallBack(void * controller, io_service_t y, [item setToolTip: @"Resume selected transfers"]; [item setImage: [NSImage imageNamed: @"ResumeSelected.png"]]; [item setTarget: self]; - [item setAction: @selector(resumeTorrent:)]; + [item setAction: @selector(resumeSelectedTorrents:)]; } else { @@ -1645,7 +1639,7 @@ static void sleepCallBack(void * controller, io_service_t y, } //enable pause item - if (action == @selector(stopTorrent:)) + if (action == @selector(stopSelectedTorrents:)) { if (!canUseMenu) return NO; @@ -1664,7 +1658,7 @@ static void sleepCallBack(void * controller, io_service_t y, } //enable resume item - if (action == @selector(resumeTorrent:)) + if (action == @selector(resumeSelectedTorrents:)) { if (!canUseMenu) return NO; diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 25b071fa3..46616594f 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -12,7 +12,7 @@ removeDeleteTorrent = id; removeNoDelete = id; resumeAllTorrents = id; - resumeTorrent = id; + resumeSelectedTorrents = id; revealFile = id; setInfoTab = id; setLimitGlobalEnabled = id; @@ -24,7 +24,7 @@ showMainWindow = id; showPreferenceWindow = id; stopAllTorrents = id; - stopTorrent = id; + stopSelectedTorrents = id; toggleAdvancedBar = id; toggleSmallView = id; toggleSpeedLimit = id; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index b72b53703..303f8c36a 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -29,6 +29,7 @@ 3 IBOpenObjects + 456 29 IBSystem Version diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index 402b97b9d..06c10cfd5 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 530d95196..f0b5e82cc 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -103,9 +103,9 @@ Torrent * torrent = [fTorrents objectAtIndex: row]; if ([torrent isPaused]) - [fController resumeTorrentWithIndex: [NSIndexSet indexSetWithIndex: row]]; + [fController resumeTorrents: [fController torrentsAtIndexes: [NSIndexSet indexSetWithIndex: row]]]; else if ([torrent isActive]) - [fController stopTorrentWithIndex: [NSIndexSet indexSetWithIndex: row]]; + [fController stopTorrents: [fController torrentsAtIndexes: [NSIndexSet indexSetWithIndex: row]]]; else; } else if (sameRow && [self pointInRevealRect: point] && [self pointInRevealRect: fClickPoint])