Changeset 2270


Ignore:
Timestamp:
Jul 1, 2007, 5:32:55 PM (15 years ago)
Author:
livings124
Message:
  • do an initialization only when needed
  • get rid of an unnecessary variable and need for release
Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r2238 r2270  
    5757    IBOutlet NSScrollView           * fScrollView;
    5858    IBOutlet TorrentTableView       * fTableView;
    59     NSToolbar                       * fToolbar;
    6059   
    6160    IBOutlet NSMenuItem             * fOpenIgnoreDownloadFolder;
  • trunk/macosx/Controller.m

    r2266 r2270  
    164164        fTorrents = [[NSMutableArray alloc] init];
    165165        fDisplayedTorrents = [[NSMutableArray alloc] init];
    166         fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
    167166       
    168167        fDefaults = [NSUserDefaults standardUserDefaults];
     
    191190    [fMessageController release];
    192191    [fPrefsController release];
    193    
    194     [fToolbar release];
    195192   
    196193    [fTorrents release];
     
    203200   
    204201    [fAutoImportedNames release];
    205     [fPendingTorrentDownloads release];
     202    if (fPendingTorrentDownloads)
     203        [fPendingTorrentDownloads release];
    206204   
    207205    tr_close(fLib);
     
    215213    [fFilterBar setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]];
    216214   
    217     [fWindow setAcceptsMouseMovedEvents: YES]; //ensure filter buttons display correctly
    218    
    219     fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Transmission Toolbar"];
    220     [fToolbar setDelegate: self];
    221     [fToolbar setAllowsUserCustomization: YES];
    222     [fToolbar setAutosavesConfiguration: YES];
    223     [fWindow setToolbar: fToolbar];
    224     [fWindow setDelegate: self];
     215    NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Transmission Toolbar"];
     216    [toolbar setDelegate: self];
     217    [toolbar setAllowsUserCustomization: YES];
     218    [toolbar setAutosavesConfiguration: YES];
     219    [fWindow setToolbar: toolbar];
     220    [toolbar release];
    225221   
    226222    [fWindow makeFirstResponder: fTableView];
    227223    [fWindow setExcludedFromWindowsMenu: YES];
     224    [fWindow setAcceptsMouseMovedEvents: YES]; //ensure filter buttons display correctly
    228225   
    229226    //set table size
     
    525522{
    526523    //remove all torrent downloads
    527     NSEnumerator * enumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
    528     NSDictionary * downloadDict;
    529     NSURLDownload * download;
    530     while ((downloadDict = [enumerator nextObject]))
    531     {
    532         download = [downloadDict objectForKey: @"Download"];
    533         [download cancel];
    534         [download release];
    535     }
    536     [fPendingTorrentDownloads removeAllObjects];
     524    NSEnumerator * enumerator;
     525    if (fPendingTorrentDownloads)
     526    {
     527        enumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
     528        NSDictionary * downloadDict;
     529        NSURLDownload * download;
     530        while ((downloadDict = [enumerator nextObject]))
     531        {
     532            download = [downloadDict objectForKey: @"Download"];
     533            [download cancel];
     534            [download release];
     535        }
     536        [fPendingTorrentDownloads removeAllObjects];
     537    }
    537538   
    538539    //stop timers
     
    618619-(void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
    619620{
     621    if (!fPendingTorrentDownloads)
     622        fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
     623   
    620624    [fPendingTorrentDownloads setObject: [NSDictionary dictionaryWithObjectsAndKeys:
    621625                    path, @"Path", download, @"Download", nil] forKey: [[download request] URL]];
  • trunk/macosx/Torrent.m

    r2269 r2270  
    195195    [fDownloadFolder release];
    196196    [fIncompleteFolder release];
    197        
     197   
    198198    [fPublicTorrentLocation release];
    199    
    200199   
    201200    [fDateAdded release];
    202201    [fDateCompleted release];
    203202    [fDateActivity release];
    204        
     203   
    205204    [fAnnounceDate release];
    206        
     205   
    207206    [fIcon release];
    208207    [fIconFlipped release];
    209208    [fIconSmall release];
    210        
     209   
    211210    [fProgressString release];
    212211    [fStatusString release];
    213212    [fShortStatusString release];
    214213    [fRemainingTimeString release];
    215        
     214   
    216215    [fFileList release];
    217216    [fFlatFileList release];
    218        
     217   
    219218    [fBitmap release];
    220219   
Note: See TracChangeset for help on using the changeset viewer.