Now using only one operationQueue and requesting status update after Add/Remove
Change-Id: I3980dfb97e61eadc405753724788d6aa888b540a
diff --git a/osx/preference-delegate.mm b/osx/preference-delegate.mm
index 113bf0b..f0c83c7 100644
--- a/osx/preference-delegate.mm
+++ b/osx/preference-delegate.mm
@@ -8,6 +8,7 @@
#include "config.h"
#import "preference-delegate.h"
+#import "menu-delegate.h"
@implementation PreferenceDelegate
@@ -17,9 +18,6 @@
[preferencesPanel makeKeyAndOrderFront:sender];
[preferencesPanel setLevel: NSStatusWindowLevel];
- if(m_operationQueue == nil)
- m_operationQueue = [[NSOperationQueue alloc] init];
-
tableController.m_tableView = fibTableView;
}
@@ -76,8 +74,8 @@
NSString *prefixName = [namePrefixText stringValue];
NSString *tunnelType = [tunnelCombobox itemObjectValueAtIndex:[tunnelCombobox indexOfSelectedItem]];
NSString *endpoint = [endpointText stringValue];
-
- [m_operationQueue addOperationWithBlock:^{
+
+ NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @NDND_FIB_COMMAND];
[task setArguments: [NSArray arrayWithObjects: @"add", prefixName, tunnelType, endpoint, nil]];
@@ -85,6 +83,7 @@
[task waitUntilExit];
}];
+ [(MenuDelegate*)[[NSApplication sharedApplication] delegate] updateStatusWithDependency:operation];
}
-(IBAction)removeFibEntry:(id)sender
@@ -102,13 +101,15 @@
if (prefix == nil)
return;
- [m_operationQueue addOperationWithBlock:^{
+ NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @NDND_FIB_COMMAND];
[task setArguments: [NSArray arrayWithObjects: @"del", prefix, @"face", faceID, nil]];
[task launch];
[task waitUntilExit];
}];
+
+ [(MenuDelegate*)[[NSApplication sharedApplication] delegate] updateStatusWithDependency:operation];
}
- (IBAction) showFibEntrySheet:(id)sender