Changeset 2255


Ignore:
Timestamp:
Jun 30, 2007, 9:53:45 PM (16 years ago)
Author:
livings124
Message:

get rid of a warning

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.h

    r2249 r2255  
    3434@interface Torrent : NSObject
    3535{
    36     tr_handle_t  * fLib;
     36    tr_handle_t * fLib;
    3737    tr_torrent_t * fHandle;
    38     tr_info_t    * fInfo;
    39     tr_stat_t    * fStat;
     38    const tr_info_t * fInfo;
     39    tr_stat_t * fStat;
    4040   
    4141    int fID;
     
    223223
    224224- (int) torrentID;
    225 - (tr_info_t *) torrentInfo;
     225- (const tr_info_t *) torrentInfo;
    226226- (tr_stat_t *) torrentStat;
    227227
  • trunk/macosx/Torrent.m

    r2251 r2255  
    819819        return YES;
    820820   
    821     NSString * volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]]
    822                                                                                                 objectAtIndex: 0];
    823     NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
    824     uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue],
    825             torrentRemaining = fStat->left;
    826    
    827     if (volumeName && remainingSpace <= torrentRemaining)
    828     {
    829         NSAlert * alert = [[NSAlert alloc] init];
    830         [alert setMessageText: [NSString stringWithFormat:
    831                                 NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
    832                                     "Torrent file disk space alert -> title"), [self name]]];
    833         [alert setInformativeText: [NSString stringWithFormat:
    834                         NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
    835                                             "Torrent file disk space alert -> message"), volumeName]];
    836         [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
    837         [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
    838         [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
    839        
    840         int result = [alert runModal];
    841         [alert release];
    842        
    843         if (result == NSAlertThirdButtonReturn)
    844             [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
    845        
    846         return result != NSAlertFirstButtonReturn;
     821    NSString * volumeName;
     822    if ((volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]] objectAtIndex: 0]))
     823    {
     824        NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
     825        uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
     826       
     827        if (remainingSpace <= fStat->left)
     828        {
     829            NSAlert * alert = [[NSAlert alloc] init];
     830            [alert setMessageText: [NSString stringWithFormat:
     831                                    NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
     832                                        "Torrent file disk space alert -> title"), [self name]]];
     833            [alert setInformativeText: [NSString stringWithFormat:
     834                            NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
     835                                                "Torrent file disk space alert -> message"), volumeName]];
     836            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
     837            [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
     838            [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
     839           
     840            int result = [alert runModal];
     841            [alert release];
     842           
     843            if (result == NSAlertThirdButtonReturn)
     844                [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
     845           
     846            return result != NSAlertFirstButtonReturn;
     847        }
    847848    }
    848849    return YES;
     
    14441445}
    14451446
    1446 - (tr_info_t *) torrentInfo
     1447- (const tr_info_t *) torrentInfo
    14471448{
    14481449    return fInfo;
Note: See TracChangeset for help on using the changeset viewer.