Changeset 12772


Ignore:
Timestamp:
Aug 27, 2011, 11:54:10 PM (10 years ago)
Author:
livings124
Message:

add an RPC session callback for when queue order changes

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpcimpl.c

    r12641 r12772  
    188188
    189189static void
    190 notifyBatchChange( tr_session * session, tr_torrent ** torrents, int n )
     190notifyBatchQueueChange( tr_session * session, tr_torrent ** torrents, int n )
    191191{
    192192    int i;
    193193    for( i=0; i<n; ++i )
    194194        notify( session, TR_RPC_TORRENT_CHANGED, torrents[i] );
     195    notify( session, TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED, NULL );
    195196}
    196197
     
    204205    tr_torrent ** torrents = getTorrents( session, args_in, &n );
    205206    tr_torrentsQueueMoveTop( torrents, n );
    206     notifyBatchChange( session, torrents, n );
     207    notifyBatchQueueChange( session, torrents, n );
    207208    tr_free( torrents );
    208209    return NULL;
     
    218219    tr_torrent ** torrents = getTorrents( session, args_in, &n );
    219220    tr_torrentsQueueMoveUp( torrents, n );
    220     notifyBatchChange( session, torrents, n );
     221    notifyBatchQueueChange( session, torrents, n );
    221222    tr_free( torrents );
    222223    return NULL;
     
    232233    tr_torrent ** torrents = getTorrents( session, args_in, &n );
    233234    tr_torrentsQueueMoveDown( torrents, n );
    234     notifyBatchChange( session, torrents, n );
     235    notifyBatchQueueChange( session, torrents, n );
    235236    tr_free( torrents );
    236237    return NULL;
     
    246247    tr_torrent ** torrents = getTorrents( session, args_in, &n );
    247248    tr_torrentsQueueMoveBottom( torrents, n );
    248     notifyBatchChange( session, torrents, n );
     249    notifyBatchQueueChange( session, torrents, n );
    249250    tr_free( torrents );
    250251    return NULL;
  • trunk/libtransmission/transmission.h

    r12640 r12772  
    518518    TR_RPC_TORRENT_MOVED,
    519519    TR_RPC_SESSION_CHANGED,
     520    TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED, /* catch potentially multiple torrents being moved in the queue */
    520521    TR_RPC_SESSION_CLOSE
    521522}
  • trunk/macosx/Controller.h

    r12686 r12772  
    262262- (void) rpcChangedTorrent: (Torrent *) torrent;
    263263- (void) rpcMovedTorrent: (Torrent *) torrent;
     264- (void) rpcUpdateQueue;
    264265
    265266@end
  • trunk/macosx/Controller.m

    r12768 r12772  
    41444144            break;
    41454145       
     4146        case TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED:
     4147            [self performSelectorOnMainThread: @selector(rpcUpdateQueue) withObject: nil waitUntilDone: NO];
     4148            break;
     4149       
    41464150        case TR_RPC_SESSION_CHANGED:
    41474151            [fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
     
    42254229}
    42264230
     4231- (void) rpcUpdateQueue
     4232{
     4233    NSLog(@"rpcUpdateQueue");
     4234   
     4235    for (Torrent * torrent in fTorrents)
     4236        [torrent update];
     4237   
     4238    NSSortDescriptor * descriptor = [[NSSortDescriptor alloc] initWithKey: @"queuePosition" ascending: YES];
     4239    NSArray * descriptors = [NSArray arrayWithObject: descriptor];
     4240    [descriptor release];
     4241   
     4242    [fTorrents sortUsingDescriptors: descriptors];
     4243   
     4244    [self fullUpdateUI];
     4245}
     4246
    42274247@end
  • trunk/macosx/Torrent.m

    r12664 r12772  
    347347}
    348348
    349 #warning remove
    350349- (NSInteger) queuePosition
    351350{
Note: See TracChangeset for help on using the changeset viewer.