Changeset 12489


Ignore:
Timestamp:
Jun 4, 2011, 1:48:56 PM (10 years ago)
Author:
livings124
Message:

When a setting in the Options inspector tab changes, send a notification, preparing for future changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoOptionsViewController.m

    r11875 r12489  
    4141- (void) setupInfo;
    4242- (void) setGlobalLabels;
     43- (void) updateOptionsNotification: (NSNotification *) notification;
    4344
    4445@end
     
    6061    [self setGlobalLabels];
    6162   
    62     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(setGlobalLabels) name: @"UpdateGlobalOptions"
    63         object: nil];
     63    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(setGlobalLabels) name: @"UpdateGlobalOptions" object: nil];
     64    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateOptionsNotification:) name: @"UpdateOptionsNotification" object: nil];
    6465}
    6566
     
    287288    NSTextField * label = upload ? fUploadLimitLabel : fDownloadLimitLabel;
    288289    [label setEnabled: limit];
     290   
     291    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    289292}
    290293
     
    297300    for (Torrent * torrent in fTorrents)
    298301        [torrent setUseGlobalSpeedLimit: limit];
     302   
     303    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    299304}
    300305
     
    306311    for (Torrent * torrent in fTorrents)
    307312        [torrent setSpeedLimit: limit upload: upload];
     313   
     314    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    308315}
    309316
     
    340347   
    341348    [fRatioLimitGlobalLabel setHidden: setting != TR_RATIOLIMIT_GLOBAL];
     349   
     350    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    342351}
    343352
     
    348357    for (Torrent * torrent in fTorrents)
    349358        [torrent setRatioLimit: limit];
     359   
     360    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    350361}
    351362
     
    383394   
    384395    [fIdleLimitGlobalLabel setHidden: setting != TR_IDLELIMIT_GLOBAL];
     396   
     397    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    385398}
    386399
     
    391404    for (Torrent * torrent in fTorrents)
    392405        [torrent setIdleLimitMinutes: limit];
     406   
     407    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    393408}
    394409
     
    416431   
    417432    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
     433   
     434    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    418435}
    419436
     
    424441    for (Torrent * torrent in fTorrents)
    425442        [torrent setMaxPeerConnect: limit];
     443   
     444    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptionsNotification" object: self];
    426445}
    427446
     
    513532}
    514533
     534- (void) updateOptionsNotification: (NSNotification *) notification
     535{
     536    if ([notification object] != self)
     537        [self updateOptions];
     538}
     539
    515540@end
Note: See TracChangeset for help on using the changeset viewer.