Changeset 5858


Ignore:
Timestamp:
May 20, 2008, 3:16:34 PM (15 years ago)
Author:
livings124
Message:

a little progress on setting up the rpc callback (no new actual functionality yet)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r5849 r5858  
    342342                        containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
    343343                        proxyType = 1;
    344                         remoteGlobalIDString = A2AAB6BA0DE0D55D00E04DDA /* shttpd */;
     344                        remoteGlobalIDString = A2AAB6BA0DE0D55D00E04DDA;
    345345                        remoteInfo = shttpd;
    346346                };
  • trunk/macosx/Controller.h

    r5851 r5858  
    231231- (void) beginCreateFile: (NSNotification *) notification;
    232232
    233 - (void) sleepCallBack: (natural_t) messageType argument: (void *) messageArgument;
     233- (void) sleepCallback: (natural_t) messageType argument: (void *) messageArgument;
    234234
    235235- (void) torrentTableViewSelectionDidChange: (NSNotification *) notification;
     
    262262- (void) prepareForUpdate:  (NSNotification *) notification;
    263263
     264- (void) rpcCallback: (tr_rpc_callback_type) type forTorrentStruct: (struct tr_torrent *) torrentStruct;
     265
    264266@end
  • trunk/macosx/Controller.m

    r5851 r5858  
    139139#define DONATE_URL  @"http://www.transmissionbt.com/donate.php"
    140140
    141 void sleepCallBack(void * controller, io_service_t y, natural_t messageType, void * messageArgument)
    142 {
    143     [(Controller *)controller sleepCallBack: messageType argument: messageArgument];
     141static void rpcCallback(tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct, void * controller)
     142{
     143    [(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
     144}
     145
     146static void sleepCallback(void * controller, io_service_t y, natural_t messageType, void * messageArgument)
     147{
     148    [(Controller *)controller sleepCallback: messageType argument: messageArgument];
    144149}
    145150
     
    228233        fSoundPlaying = NO;
    229234       
     235        tr_sessionSetRPCCallback(fLib, rpcCallback, self);
     236       
    230237        [GrowlApplicationBridge setGrowlDelegate: self];
    231238        [[UKKQueue sharedFileWatcher] setDelegate: self];
     
    336343    IONotificationPortRef notify;
    337344    io_object_t iterator;
    338     if ((fRootPort = IORegisterForSystemPower(self, & notify, sleepCallBack, &iterator)))
     345    if ((fRootPort = IORegisterForSystemPower(self, & notify, sleepCallback, &iterator)))
    339346        CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopCommonModes);
    340347    else
     
    37593766}
    37603767
    3761 - (void) sleepCallBack: (natural_t) messageType argument: (void *) messageArgument
     3768- (void) sleepCallback: (natural_t) messageType argument: (void *) messageArgument
    37623769{
    37633770    NSEnumerator * enumerator;
     
    40474054}
    40484055
     4056- (void) rpcCallback: (tr_rpc_callback_type) type forTorrentStruct: (struct tr_torrent *) torrentStruct
     4057{
     4058    //get the torrent
     4059    if (torrentStruct != NULL)
     4060    {
     4061        NSEnumerator * enumerator = [fTorrents objectEnumerator];
     4062        Torrent * torrent;
     4063        while ((torrent = [enumerator nextObject]))
     4064            if (torrentStruct == [torrent torrentStruct])
     4065                break;
     4066       
     4067        if (!torrent)
     4068        {
     4069            NSLog(@"No torrent found matching torrent struct given in RPC callback!");
     4070            return;
     4071        }
     4072    }
     4073   
     4074    switch (type)
     4075    {
     4076        case TR_RPC_TORRENT_ADDED:
     4077            break;
     4078        case TR_RPC_TORRENT_STARTED:
     4079            break;
     4080        case TR_RPC_TORRENT_STOPPED:
     4081            break;
     4082        case TR_RPC_TORRENT_CLOSING:
     4083            break;
     4084        case TR_RPC_TORRENT_CHANGED:
     4085            break;
     4086        case TR_RPC_SESSION_CHANGED:
     4087            break;
     4088    }
     4089}
     4090
    40494091/*- (void) ipcQuit
    40504092{
  • trunk/macosx/Torrent.h

    r5678 r5858  
    4040    const tr_info * fInfo;
    4141    const tr_stat * fStat;
    42    
    43     int fID;
    4442   
    4543    BOOL fResumeOnWake;
     
    252250- (NSNumber *) stateSortKey;
    253251
    254 - (int) torrentID;
    255252- (tr_torrent *) torrentStruct;
    256253
  • trunk/macosx/Torrent.m

    r5849 r5858  
    2727#import "NSApplicationAdditions.h"
    2828#import "NSStringAdditions.h"
    29 
    30 static int static_lastid = 0;
    3129
    3230@interface Torrent (Private)
     
    15181516}
    15191517
    1520 - (int) torrentID
    1521 {
    1522     return fID;
    1523 }
    1524 
    15251518- (tr_torrent *) torrentStruct
    15261519{
     
    15451538    if (!(self = [super init]))
    15461539        return nil;
    1547    
    1548     static_lastid++;
    1549     fID = static_lastid;
    15501540   
    15511541    fDefaults = [NSUserDefaults standardUserDefaults];
Note: See TracChangeset for help on using the changeset viewer.