Changeset 1012


Ignore:
Timestamp:
Oct 16, 2006, 2:35:42 AM (15 years ago)
Author:
livings124
Message:

Don't auto-import torrents after they have been auto-imported. Useful for removing a transfer without it instantly being re-added.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r923 r1012  
    9393    BOOL                            fUpdateInProgress;
    9494    Badger                          * fBadger;
     95   
     96    NSArray                         * fAutoImportedNames;
    9597}
    9698
     
    176178- (void) attemptToStartMultipleAuto: (NSArray *) torrents;
    177179
     180- (void) changeAutoImport;
    178181- (void) checkAutoImportDirectory;
    179182
  • trunk/macosx/Controller.m

    r1009 r1012  
    114114    [fFilterType release];
    115115   
     116    if (fAutoImportedNames)
     117        [fAutoImportedNames release];
     118   
    116119    tr_close(fLib);
    117120    [super dealloc];
     
    321324                    name: @"AutoSpeedLimitChange" object: nil];
    322325   
    323     [nc addObserver: self selector: @selector(checkAutoImportDirectory)
     326    [nc addObserver: self selector: @selector(changeAutoImport)
    324327                    name: @"AutoImportSettingChange" object: nil];
    325328   
     
    15591562}
    15601563
     1564- (void) changeAutoImport
     1565{
     1566    if (fAutoImportedNames)
     1567    {
     1568        [fAutoImportedNames release];
     1569        fAutoImportedNames = nil;
     1570    }
     1571   
     1572    if ([fDefaults boolForKey: @"AutoImport"])
     1573        [self checkAutoImportDirectory];
     1574}
     1575
    15611576- (void) checkAutoImportDirectory
    15621577{
     
    15701585        return;
    15711586   
    1572     NSEnumerator * enumerator = [importedNames objectEnumerator];
     1587    //only import those that have not been imported yet
     1588    NSMutableArray * newNames = [importedNames mutableCopy];
     1589    [newNames removeObjectsInArray: fAutoImportedNames];
     1590    if (fAutoImportedNames)
     1591        [fAutoImportedNames release];
     1592    fAutoImportedNames = [importedNames retain];
     1593   
     1594    NSEnumerator * enumerator = [newNames objectEnumerator];
    15731595    NSString * file;
    15741596    unsigned oldCount;
    15751597    while ((file = [enumerator nextObject]))
     1598    {
    15761599        if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    15771600        {
     
    15841607                    notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
    15851608        }
     1609    }
     1610   
     1611    [newNames release];
    15861612}
    15871613
Note: See TracChangeset for help on using the changeset viewer.