1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

a little better menu item validation

This commit is contained in:
Mitchell Livingston 2007-01-09 15:06:45 +00:00
parent f23d2aa950
commit 73565b2bc4

View file

@ -2361,7 +2361,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
Torrent * torrent; Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator]; NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
if (![torrent isActive] && [torrent waitingToStart]) if ([torrent isPaused] && [torrent waitingToStart])
return YES; return YES;
return NO; return NO;
} }
@ -2375,10 +2375,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator]; NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
Torrent * torrent; Torrent * torrent;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
{ if ([torrent isPaused])
if (![torrent isActive])
return YES; return YES;
}
return NO; return NO;
} }
@ -2391,10 +2389,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator]; NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
Torrent * torrent; Torrent * torrent;
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
{
if ([torrent isActive] || [torrent waitingToStart]) if ([torrent isActive] || [torrent waitingToStart])
return YES; return YES;
}
return NO; return NO;
} }
@ -2404,16 +2400,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if (!canUseTable) if (!canUseTable)
return NO; return NO;
NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
Torrent * torrent; Torrent * torrent;
NSIndexSet * indexSet = [fTableView selectedRowIndexes]; while ((torrent = [enumerator nextObject]))
unsigned int i;
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
{
torrent = [fDisplayedTorrents objectAtIndex: i];
if ([torrent isPaused] && ![torrent waitingToStart]) if ([torrent isPaused] && ![torrent waitingToStart])
return YES; return YES;
}
return NO; return NO;
} }