Implement async FIB table manipulation
Implementation reuses the status information from NdnStatusOperation and
uses XSLT for basic preprocessing.
Change-Id: Id3dba1779e02451772d09bdc919fdc68475171a9
diff --git a/osx/menu-delegate.mm b/osx/menu-delegate.mm
index 24102fd..c47e0b9 100644
--- a/osx/menu-delegate.mm
+++ b/osx/menu-delegate.mm
@@ -32,6 +32,7 @@
m_connectedIcon = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"FlatConnected" ofType:@"png"]];
m_disconnectedIcon = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"FlatDisconnected" ofType:@"png"]];
m_statusXslt = [NSData dataWithContentsOfFile:[bundle pathForResource:@"status" ofType:@"xslt"]];
+ m_statusToFibXslt = [NSData dataWithContentsOfFile:[bundle pathForResource:@"status-to-fib" ofType:@"xslt"]];
NSTimer *t = [NSTimer scheduledTimerWithTimeInterval: 1.0
target: self
@@ -116,12 +117,18 @@
[statusItem setImage:m_connectedIcon];
}
- NSXMLDocument *result = [document objectByApplyingXSLT:m_statusXslt
- arguments:nil
- error:nil];
+ NSXMLDocument *statusXml = [document objectByApplyingXSLT:m_statusXslt
+ arguments:nil
+ error:nil];
- m_statusString = [[NSAttributedString alloc]initWithHTML:[result XMLData] documentAttributes:NULL];
+ NSXMLDocument *statusFibXml = [document objectByApplyingXSLT:m_statusToFibXslt
+ arguments:nil
+ error:nil];
+
+ m_statusString = [[NSAttributedString alloc]initWithHTML:[statusXml XMLData] documentAttributes:NULL];
[daemonStatusHtml setAttributedStringValue:m_statusString];
+
+ [preferencesDelegate updateFibStatus:statusFibXml];
}
- (void)statusUnavailable:(id)none
@@ -134,7 +141,10 @@
[statusItem setImage:m_disconnectedIcon];
}
-
+
+ [daemonStatusHtml setStringValue:@""];
+ [preferencesDelegate updateFibStatus:nil];
+
[m_operationQueue addOperationWithBlock:^{
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @NDND_START_COMMAND];