Changeset 5840


Ignore:
Timestamp:
May 16, 2008, 12:25:09 AM (14 years ago)
Author:
livings124
Message:

#948 - when processing the blocklist, don't block the gui (Leopard-only)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BlocklistDownloader.m

    r5633 r5840  
    3535- (id) initWithPrefsController: (PrefsController *) prefsController;
    3636- (void) startDownload;
     37- (void) finishDownloadSuccess;
    3738- (void) updateProcessString;
    3839- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
     
    109110- (void) downloadDidFinish: (NSURLDownload *) download
    110111{
    111     //change to indeterminate while processing
    112     [fProgressBar setIndeterminate: YES];
    113     [fProgressBar startAnimation: self];
    114    
    115     [fTextField setStringValue: [NSLocalizedString(@"Processing blocklist", "Blocklist -> message") stringByAppendingEllipsis]];
    116     [fButton setEnabled: NO];
    117     [fStatusWindow display]; //force window to be updated
    118    
    119     //process data
    120     tr_blocklistSetContent([fPrefsController handle], [DESTINATION UTF8String]);
    121    
    122     //delete downloaded file
    123112    if ([NSApp isOnLeopardOrBetter])
    124         [[NSFileManager defaultManager] removeItemAtPath: DESTINATION error: NULL];
     113        [self performSelectorInBackground: @selector(finishDownloadSuccess) withObject: nil];
    125114    else
    126         [[NSFileManager defaultManager] removeFileAtPath: DESTINATION handler: nil];
    127    
    128     [fPrefsController updateBlocklistFields];
    129    
    130     [NSApp endSheet: fStatusWindow];
    131     [fStatusWindow orderOut: self];
    132     [self release];
     115        [self finishDownloadSuccess];
    133116}
    134117
     
    160143}
    161144
     145- (void) finishDownloadSuccess
     146{
     147    //change to indeterminate while processing
     148    [fProgressBar setIndeterminate: YES];
     149    [fProgressBar startAnimation: self];
     150   
     151    [fTextField setStringValue: [NSLocalizedString(@"Processing blocklist", "Blocklist -> message") stringByAppendingEllipsis]];
     152    [fButton setEnabled: NO];
     153    [fStatusWindow display]; //force window to be updated
     154   
     155    //process data
     156    tr_blocklistSetContent([fPrefsController handle], [DESTINATION UTF8String]);
     157   
     158    //delete downloaded file
     159    if ([NSApp isOnLeopardOrBetter])
     160        [[NSFileManager defaultManager] removeItemAtPath: DESTINATION error: NULL];
     161    else
     162        [[NSFileManager defaultManager] removeFileAtPath: DESTINATION handler: nil];
     163   
     164    [fPrefsController updateBlocklistFields];
     165   
     166    [NSApp endSheet: fStatusWindow];
     167    [fStatusWindow orderOut: self];
     168    [self release];
     169}
     170
    162171- (void) updateProcessString
    163172{
Note: See TracChangeset for help on using the changeset viewer.