[54273] branches/gsoc09-gui/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Fri Jul 24 00:28:44 PDT 2009
Revision: 54273
http://trac.macports.org/changeset/54273
Author: juanger at macports.org
Date: 2009-07-24 00:28:44 -0700 (Fri, 24 Jul 2009)
Log Message:
-----------
Adding a delegate to send notifications via SimpleLog.
Modified Paths:
--------------
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h
branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-07-24 07:27:37 UTC (rev 54272)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-07-24 07:28:44 UTC (rev 54273)
@@ -104,7 +104,11 @@
+(void) setPKGPath:(NSString*)newPath;
++(id) delegate;
++(void) setDelegate:(id)newDelegate;
+
+
//Internal methods
-(BOOL) setOptionsForNewTclPort:(NSArray *)options;
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-07-24 07:27:37 UTC (rev 54272)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-07-24 07:28:44 UTC (rev 54273)
@@ -39,6 +39,7 @@
#include "MPHelperNotificationsProtocol.h"
static AuthorizationRef internalMacPortsAuthRef;
static NSString* PKGPath = @"/Library/Tcl";
+static id delegate;
#pragma mark -
@@ -164,6 +165,15 @@
//tool
static NSString * tclInterpreterPkgPath = nil;
++(id) delegate {
+ return delegate;
+}
+
++(void) setDelegate:(id)newDelegate {
+ delegate = newDelegate;
+}
+
+
+(NSString*) PKGPath {
return PKGPath;
}
@@ -458,22 +468,22 @@
NSString * firstResult;
NSString * secondResult;
- //*mportError = nil;
- //firstResult = [self evaluateStringWithMPPortProcess:statement error:mportError];
+ *mportError = nil;
+ firstResult = [self evaluateStringWithMPPortProcess:statement error:mportError];
//Because of string results of methods like mportsync (which returns the empty string)
//the only way to truly check for an error is to check the mportError parameter.
//If it is nil then there was no error, if not we re-evaluate with privileges using
//the helper tool
- //if ( *mportError != nil) {
+ if ( *mportError != nil) {
*mportError = nil;
secondResult = [self evaluateStringWithMPHelperTool:statement error:mportError];
return secondResult;
- //}
+ }
- //return firstResult;
+ return firstResult;
}
//NOTE: We expect the Framework client to initialize the AuthorizationRef
@@ -682,7 +692,7 @@
}
while (theProxy == nil);
- [theProxy evaluateString:statement];
+ [theProxy evaluateString:statement delegate:delegate];
return nil;
}
Modified: branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h 2009-07-24 07:27:37 UTC (rev 54272)
+++ branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h 2009-07-24 07:28:44 UTC (rev 54273)
@@ -80,6 +80,10 @@
+ (void) setPKGPath:(NSString*)newPath;
++ (id) notificationsDelegate;
+
++ (void) setNotificationsDelegate:(id)newDelegate;
+
/*!
@brief Returns an MPMacPorts object that represents the MacPorts system on user's machine.
*/
Modified: branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-07-24 07:27:37 UTC (rev 54272)
+++ branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-07-24 07:28:44 UTC (rev 54273)
@@ -59,6 +59,15 @@
[MPInterpreter setPKGPath:newPath];
}
++(id) notificationsDelegate {
+ return [MPInterpreter delegate];
+}
+
++(void) setNotificationsDelegate:(id)newDelegate {
+ [MPInterpreter setDelegate:newDelegate];
+}
+
+
+ (MPMacPorts *)sharedInstance {
return [self sharedInstanceWithPkgPath:[MPInterpreter PKGPath] portOptions:nil];
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090724/3d1b9203/attachment.html>
More information about the macports-changes
mailing list