Changeset 13161


Ignore:
Timestamp:
Jan 14, 2012, 4:08:45 PM (10 years ago)
Author:
livings124
Message:

use GCD instead of a variable to not animate the main table at launch

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r13141 r13161  
    9292   
    9393    QLPreviewPanel                  * fPreviewPanel;
    94     BOOL                            fLaunching;
    9594    BOOL                            fQuitting;
    9695    BOOL                            fQuitRequested;
  • trunk/macosx/Controller.m

    r13156 r13161  
    214214    if ((self = [super init]))
    215215    {
    216         fLaunching = YES;
    217        
    218216        fDefaults = [NSUserDefaults standardUserDefaults];
    219217       
     
    517515    if ([fDefaults boolForKey: @"InfoVisible"])
    518516        [self showInfo: nil];
    519    
    520     fLaunching = NO;
    521517}
    522518
     
    21872183    BOOL beganUpdates = NO;
    21882184   
    2189     //don't animate torrents when first launching
    2190     if (onLion && fLaunching)
    2191     {
    2192         [[NSAnimationContext currentContext] setDuration: 0];
     2185    if (onLion)
     2186    {
     2187        //don't animate torrents when first launching
     2188        static dispatch_once_t onceToken;
     2189        dispatch_once(&onceToken, ^{
     2190            [[NSAnimationContext currentContext] setDuration: 0];
     2191        });
    21932192        [NSAnimationContext beginGrouping];
    21942193    }
     
    22042203       
    22052204        //for each of the torrents to add, find if it already exists (and keep track of those we've already added & those we need to remove)
    2206         [allTorrents enumerateObjectsWithOptions: 0 usingBlock:^(id objAll, NSUInteger previousIndex, BOOL * stop) {
     2205        [allTorrents enumerateObjectsWithOptions: 0 usingBlock: ^(id objAll, NSUInteger previousIndex, BOOL * stop) {
    22072206            const NSUInteger currentIndex = [fDisplayedTorrents indexOfObjectAtIndexes: removePreviousIndexes options: NSEnumerationConcurrent passingTest: ^(id objDisplay, NSUInteger idx, BOOL *stop) {
    22082207                return (BOOL)(objAll == objDisplay);
     
    22652264       
    22662265        NSMutableDictionary * groupsByIndex = [NSMutableDictionary dictionaryWithCapacity: [fDisplayedTorrents count]];
    2267        
    2268         #warning necessary? make more efficient?
    22692266        for (TorrentGroup * group in fDisplayedTorrents)
    22702267            [groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: [group groupIndex]]];
     
    24242421        [fTableView setNeedsDisplay: YES];
    24252422       
    2426         if (fLaunching)
    2427             [NSAnimationContext endGrouping];
     2423        [NSAnimationContext endGrouping];
    24282424    }
    24292425    else
Note: See TracChangeset for help on using the changeset viewer.