Ignore:
Timestamp:
Jan 19, 2013, 5:03:00 AM (9 years ago)
Author:
livings124
Message:

#5223 Use VDKQueue for watching for torrent files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13684 r13804  
    6161#import "variant.h"
    6262
    63 #import "UKKQueue.h"
     63#import "VDKQueue.h"
    6464#import <Sparkle/Sparkle.h>
    6565
     
    161161@synthesize prefsController = fPrefsController;
    162162@synthesize messageWindowController = fMessageController;
     163@synthesize fileWatcherQueue = fFileWatcherQueue;
    163164
    164165+ (void) initialize
     
    372373        fInfoController = [[InfoWindowController alloc] init];
    373374       
     375        //needs to be done before init-ing the prefs controller
     376        fFileWatcherQueue = [[[VDKQueue alloc] init] autorelease];
     377        [fFileWatcherQueue setDelegate: self];
     378       
    374379        fPrefsController = [[PrefsController alloc] initWithHandle: fLib];
    375380       
     
    385390       
    386391        [GrowlApplicationBridge setGrowlDelegate: self];
    387        
    388         [[UKKQueue sharedFileWatcher] setDelegate: self];
    389392       
    390393        [[SUUpdater sharedUpdater] setDelegate: self];
     
    777780   
    778781    [fConfigDirectory release];
     782   
     783    [fFileWatcherQueue release];
    779784   
    780785    //complete cleanup
     
    29302935}
    29312936
    2932 - (void) watcher: (id<UKFileWatcher>) watcher receivedNotification: (NSString *) notification forPath: (NSString *) path
    2933 {
    2934     if ([notification isEqualToString: UKFileWatcherWriteNotification])
    2935     {
    2936         if (![fDefaults boolForKey: @"AutoImport"] || ![fDefaults stringForKey: @"AutoImportDirectory"])
    2937             return;
    2938        
    2939         if (fAutoImportTimer)
    2940         {
    2941             if ([fAutoImportTimer isValid])
    2942                 [fAutoImportTimer invalidate];
    2943             [fAutoImportTimer release];
    2944             fAutoImportTimer = nil;
    2945         }
    2946        
    2947         //check again in 10 seconds in case torrent file wasn't complete
    2948         fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
    2949             selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
    2950        
    2951         [self checkAutoImportDirectory];
    2952     }
     2937-(void) VDKQueue: (VDKQueue *) queue receivedNotification: (NSString*) notification forPath: (NSString*) fpath
     2938{
     2939    NSParameterAssert([notification isEqualToString:VDKQueueWriteNotification]);NSLog(@"%@",notification);
     2940   
     2941    if (![fDefaults boolForKey: @"AutoImport"] || ![fDefaults stringForKey: @"AutoImportDirectory"])
     2942        return;
     2943   
     2944    if (fAutoImportTimer)
     2945    {
     2946        if ([fAutoImportTimer isValid])
     2947            [fAutoImportTimer invalidate];
     2948        [fAutoImportTimer release];
     2949        fAutoImportTimer = nil;
     2950    }
     2951   
     2952    //check again in 10 seconds in case torrent file wasn't complete
     2953    fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
     2954        selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
     2955   
     2956    [self checkAutoImportDirectory];
    29532957}
    29542958
Note: See TracChangeset for help on using the changeset viewer.