Start/Stop button changes icon and connection status
Change-Id: I5bbc6be48ec4877272f91dc103602ee5259228b2
diff --git a/osx/menu-delegate.mm b/osx/menu-delegate.mm
index a425af2..35e3881 100644
--- a/osx/menu-delegate.mm
+++ b/osx/menu-delegate.mm
@@ -26,10 +26,38 @@
//[statusItem setTarget:self];
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- NSString *path = [bundle pathForResource:@"IconDisconnected" ofType:@"png"];
+ NSString *path = [bundle pathForResource:@"FlatDisconnected" ofType:@"png"];
menuIcon = [[NSImage alloc] initWithContentsOfFile:path];
[statusItem setTitle:@""];
[statusItem setImage:menuIcon];
+
+ daemonStarted = false;
+}
+
+-(IBAction)switchDaemon:(id)sender
+{
+ if (daemonStarted)
+ {
+ daemonStarted = false;
+ [sender setTitle:@"Start"];
+ [connectionStatus setTitle:@"NDN disconnected"];
+
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+ NSString *path = [bundle pathForResource:@"FlatDisconnected" ofType:@"png"];
+ menuIcon = [[NSImage alloc] initWithContentsOfFile:path];
+ [statusItem setImage:menuIcon];
+ }
+ else
+ {
+ daemonStarted = true;
+ [sender setTitle:@"Stop"];
+ [connectionStatus setTitle:@"NDN connected"];
+
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+ NSString *path = [bundle pathForResource:@"FlatConnected" ofType:@"png"];
+ menuIcon = [[NSImage alloc] initWithContentsOfFile:path];
+ [statusItem setImage:menuIcon];
+ }
}
-(IBAction)openDaemonStatus:(id)sender