Changeset 54273


Ignore:
Timestamp:
Jul 24, 2009, 7:28:44 AM (10 years ago)
Author:
juanger@…
Message:

Adding a delegate to send notifications via SimpleLog.

Location:
branches/gsoc09-gui/MacPorts_Framework
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h

    r53692 r54273  
    105105+(void) setPKGPath:(NSString*)newPath;
    106106
     107+(id) delegate;
     108
     109+(void) setDelegate:(id)newDelegate;
     110
    107111
    108112//Internal methods
  • branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m

    r54152 r54273  
    4040static AuthorizationRef internalMacPortsAuthRef;
    4141static NSString* PKGPath = @"/Library/Tcl";
     42static id delegate;
    4243
    4344
     
    164165//tool
    165166static NSString * tclInterpreterPkgPath = nil;
     167
     168+(id) delegate {
     169    return delegate;
     170}
     171
     172+(void) setDelegate:(id)newDelegate {
     173    delegate = newDelegate;
     174}
     175
    166176
    167177+(NSString*) PKGPath {
     
    459469        NSString * secondResult;
    460470       
    461         //*mportError = nil;
    462         //firstResult = [self evaluateStringWithMPPortProcess:statement error:mportError];
     471        *mportError = nil;
     472        firstResult = [self evaluateStringWithMPPortProcess:statement error:mportError];
    463473       
    464474        //Because of string results of methods like mportsync (which returns the empty string)
     
    467477        //the helper tool
    468478       
    469         //if ( *mportError != nil) {
     479        if ( *mportError != nil) {
    470480                *mportError = nil;
    471481                secondResult = [self evaluateStringWithMPHelperTool:statement error:mportError];
    472482               
    473483                return secondResult;
    474         //}
    475        
    476         //return firstResult;
     484        }
     485       
     486        return firstResult;
    477487}
    478488
     
    683693    while (theProxy == nil);
    684694   
    685     [theProxy evaluateString:statement];
     695    [theProxy evaluateString:statement delegate:delegate];
    686696    return nil;
    687697}
  • branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h

    r52375 r54273  
    8181+ (void) setPKGPath:(NSString*)newPath;
    8282
     83+ (id) notificationsDelegate;
     84
     85+ (void) setNotificationsDelegate:(id)newDelegate;
     86
    8387/*!
    8488 @brief Returns an MPMacPorts object that represents the MacPorts system on user's machine.
  • branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m

    r52375 r54273  
    6060}
    6161
     62+(id) notificationsDelegate {
     63        return [MPInterpreter delegate];
     64}
     65
     66+(void) setNotificationsDelegate:(id)newDelegate {
     67    [MPInterpreter setDelegate:newDelegate];
     68}
     69
     70
    6271+ (MPMacPorts *)sharedInstance {
    6372        return [self sharedInstanceWithPkgPath:[MPInterpreter PKGPath] portOptions:nil];
Note: See TracChangeset for help on using the changeset viewer.