Changeset 4276


Ignore:
Timestamp:
Dec 22, 2007, 3:39:52 AM (14 years ago)
Author:
livings124
Message:

switch-ify an if

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r4275 r4276  
    23302330   
    23312331    NSEnumerator * enumerator = [newNames objectEnumerator];
    2332     int canAdd, count;
     2332    int count;
    23332333    tr_ctor * ctor;
    23342334    while ((file = [enumerator nextObject]))
    23352335    {
    2336         tr_ctor * ctor = tr_ctorNew(fLib);
     2336        ctor = tr_ctorNew(fLib);
    23372337        tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]);
    2338         canAdd = tr_torrentParseFromCtor(fLib, ctor, NULL);
     2338       
     2339        switch (tr_torrentParseFromCtor(fLib, ctor, NULL))
     2340        {
     2341            case TR_OK:
     2342                if (!ask)
     2343                    count = [fTorrents count];
     2344                [self openFiles: [NSArray arrayWithObject: file]];
     2345               
     2346                //check if torrent was opened
     2347                if (!ask && [fTorrents count] > count)
     2348                    [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
     2349                        "Growl notification title") description: [file lastPathComponent]
     2350                        notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
     2351                break;
     2352           
     2353            case TR_EINVALID:
     2354                [fAutoImportedNames removeObject: [file lastPathComponent]];
     2355        }
     2356       
    23392357        tr_ctorFree(ctor);
    2340        
    2341         if (canAdd == TR_OK)
    2342         {
    2343             if (!ask)
    2344                 count = [fTorrents count];
    2345             [self openFiles: [NSArray arrayWithObject: file]];
    2346            
    2347             //check if torrent was opened
    2348             if (!ask && [fTorrents count] > count)
    2349                 [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
    2350                     "Growl notification title") description: [file lastPathComponent]
    2351                     notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
    2352         }
    2353         else if (canAdd == TR_EINVALID)
    2354             [fAutoImportedNames removeObject: [file lastPathComponent]];
    2355         else;
    23562358    }
    23572359   
Note: See TracChangeset for help on using the changeset viewer.