Changeset 105

Show
Ignore:
Timestamp:
08/12/07 22:18:15 (1 year ago)
Author:
robert
Message:

Growl notifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/robert/English.lproj/Localizable.strings

    r64 r105  
    112112 
    113113"UnknownHostKey" = "Unknown Host Key"; 
     114 
     115"TunnelOpened" = "Tunnel Opened"; 
     116"TunnelHasBeenOpened" = "The tunnel has been opened."; 
     117"TunnelClosed" = "Tunnel Closed"; 
     118"TunnelHasBeenClosed" = "The tunnel has been closed."; 
     119"TunnelRestart" = "Tunnel Restart"; 
     120"TunnelIsBeeingRestarted" = "The tunnel is beeing restarted."; 
  • branches/robert/GrowlNotificationController.h

    r104 r105  
    1212 
    1313/* events */ 
    14 - (void) tunnelOpened; 
     14- (void) tunnelOpened:(NSString *) tunnelName; 
     15- (void) tunnelClosed:(NSString *) tunnelName; 
     16- (void) tunnelRestart:(NSString *) tunnelName; 
    1517- (void) warningWithTitle:(NSString *)title andMessage:(NSString *)message; 
    1618@end 
  • branches/robert/GrowlNotificationController.m

    r104 r105  
    11#import "GrowlNotificationController.h" 
    22#import "PreferenceController.h" 
     3 
     4/* This function resides in Controller.m. */ 
     5extern NSString *local(NSString *theString); 
    36 
    47@implementation GrowlNotificationController 
     
    1316        NSArray *notifications; 
    1417         
    15         notifications = [NSArray arrayWithObjects: @"Tunnel Opened", @"Warning", nil]; 
     18        notifications = [NSArray arrayWithObjects: @"Tunnel Opened", @"Tunnel Closed", @"Tunnel Restart", @"Warning", nil]; 
    1619         
    1720        NSDictionary *dict; 
     
    2831} 
    2932 
    30 - (void) tunnelOpened 
     33- (void) tunnelOpened:(NSString *) tunnelName 
    3134{ 
    3235        if ([self isOn]) { 
    3336                [GrowlApplicationBridge  
    34                         notifyWithTitle:@"Tunnel Opened" 
    35                                 description:@"Yuppi!" 
     37                        notifyWithTitle:local(@"TunnelOpened") 
     38                                description:[NSString stringWithFormat: @"(%@) %@", tunnelName, local(@"TunnelHasBeenOpened")] 
    3639                   notificationName:@"Tunnel Opened" 
     40                                   iconData:nil 
     41                                   priority:0 
     42                                   isSticky:NO 
     43                           clickContext:nil]; 
     44        } 
     45} 
     46 
     47- (void) tunnelClosed:(NSString *) tunnelName 
     48{ 
     49        if ([self isOn]) { 
     50                [GrowlApplicationBridge  
     51                        notifyWithTitle:local(@"TunnelClosed") 
     52                                description:[NSString stringWithFormat: @"(%@) %@", tunnelName, local(@"TunnelHasBeenClosed")] 
     53                   notificationName:@"Tunnel Closed" 
     54                                   iconData:nil 
     55                                   priority:0 
     56                                   isSticky:NO 
     57                           clickContext:nil]; 
     58        } 
     59} 
     60 
     61- (void) tunnelRestart:(NSString *) tunnelName 
     62{ 
     63        if ([self isOn]) { 
     64                [GrowlApplicationBridge  
     65                        notifyWithTitle:local(@"TunnelRestart") 
     66                                description:[NSString stringWithFormat: @"(%@) %@", tunnelName, local(@"TunnelIsBeeingRestarted")] 
     67                   notificationName:@"Tunnel Restart" 
    3768                                   iconData:nil 
    3869                                   priority:0 
  • branches/robert/TunnelController.m

    r104 r105  
    325325 
    326326                [tunnel closeTunnel]; 
     327                 
     328                [growlNotificationController tunnelClosed:[aTunnel objectForKey:@"TunnelName"]]; 
    327329                 
    328330                [dict removeObjectForKey:@"TunnelObject"]; 
     
    528530                                withInfo:[dict objectForKey:@"TunnelUUID"]]; 
    529531         
     532        if ([dict objectForKey:@"LastTerminated"]) { 
     533                [growlNotificationController tunnelRestart: [dict objectForKey:@"TunnelName"]]; 
     534        } 
     535         
    530536        if([tunnel openTunnel])  
    531537        { 
     
    540546                [self setToolTipForActiveTunnels]; 
    541547                 
    542                 [growlNotificationController tunnelOpened]; 
     548                if (! [dict objectForKey:@"LastTerminated"]) { 
     549                        [growlNotificationController tunnelOpened: [dict objectForKey:@"TunnelName"]]; 
     550                } 
    543551        } 
    544552        /* Either the dictionary has it, or it didn't work and we don't want it. */