Changeset 8119


Ignore:
Timestamp:
Mar 30, 2009, 10:18:25 PM (13 years ago)
Author:
livings124
Message:

only show a Growl notification when the speed limit is auto-enable/disabled

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r8098 r8119  
    212212- (void) toggleSpeedLimit: (id) sender;
    213213- (void) speedLimitChanged: (id) sender;
    214 - (void) altSpeedToggledCallbackIsLimited: (NSNumber *) limited;
     214- (void) altSpeedToggledCallbackIsLimited: (NSDictionary *) dict;
    215215
    216216- (void) setLimitGlobalEnabled: (id) sender;
  • trunk/macosx/Controller.m

    r8118 r8119  
    146146static void altSpeedToggledCallback(tr_session * handle UNUSED, tr_bool active, tr_bool byUser, void * controller)
    147147{
     148    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSNumber alloc] initWithBool: active], @"Active",
     149                                [[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
    148150    [(Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
    149         withObject: [[NSNumber alloc] initWithBool: active] waitUntilDone: NO];
     151        withObject: dict waitUntilDone: NO];
    150152}
    151153
     
    23232325}
    23242326
    2325 //limited has been retained
    2326 - (void) altSpeedToggledCallbackIsLimited: (NSNumber *) limited
    2327 {
    2328     const BOOL isLimited = [limited boolValue];
     2327//dict has been retained
     2328- (void) altSpeedToggledCallbackIsLimited: (NSDictionary *) dict
     2329{
     2330    const BOOL isLimited = [[dict objectForKey: @"Active"] boolValue];
    23292331
    23302332    [fDefaults setBool: isLimited forKey: @"SpeedLimit"];
    23312333    [self updateSpeedFieldsToolTips];
    23322334   
    2333     #warning don't show on startup or on manual changed
    2334     [GrowlApplicationBridge notifyWithTitle: isLimited
    2335             ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
    2336             : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
    2337         description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
    2338         notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
    2339    
    2340     [limited release];
     2335    if (![[dict objectForKey: @"ByUser"] boolValue])
     2336        [GrowlApplicationBridge notifyWithTitle: isLimited
     2337                ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
     2338                : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
     2339            description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
     2340            notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
     2341   
     2342    [dict release];
    23412343}
    23422344
Note: See TracChangeset for help on using the changeset viewer.