add an RPC session callback for when queue order changes

This commit is contained in:
Mitchell Livingston
2011-08-27 23:54:10 +00:00
parent f2f0dc1861
commit 516164e78e
5 changed files with 28 additions and 6 deletions

View File

@@ -4143,6 +4143,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[self performSelectorOnMainThread: @selector(rpcMovedTorrent:) withObject: torrent waitUntilDone: NO];
break;
case TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED:
[self performSelectorOnMainThread: @selector(rpcUpdateQueue) withObject: nil waitUntilDone: NO];
break;
case TR_RPC_SESSION_CHANGED:
[fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
break;
@@ -4224,4 +4228,20 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
[torrent release];
}
- (void) rpcUpdateQueue
{
NSLog(@"rpcUpdateQueue");
for (Torrent * torrent in fTorrents)
[torrent update];
NSSortDescriptor * descriptor = [[NSSortDescriptor alloc] initWithKey: @"queuePosition" ascending: YES];
NSArray * descriptors = [NSArray arrayWithObject: descriptor];
[descriptor release];
[fTorrents sortUsingDescriptors: descriptors];
[self fullUpdateUI];
}
@end