[38023] branches/gsoc08-framework/MacPorts.Framework

armahg at macports.org armahg at macports.org
Thu Jul 3 00:08:54 PDT 2008


Revision: 38023
          http://trac.macosforge.org/projects/macports/changeset/38023
Author:   armahg at macports.org
Date:     2008-07-03 00:08:48 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Completed basic sending of global notifications from MacPorts Tcl API code.

Modified Paths:
--------------
    branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
    branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m
    branches/gsoc08-framework/MacPorts.Framework/init.tcl
    branches/gsoc08-framework/MacPorts.Framework/notifications.m

Modified: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h	2008-07-03 02:31:50 UTC (rev 38022)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h	2008-07-03 07:08:48 UTC (rev 38023)
@@ -54,5 +54,6 @@
 -(void) testSearch;
 -(void) testSync;
 -(void) testVersion;
+-(void) testInstall;
 
 @end

Modified: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m	2008-07-03 02:31:50 UTC (rev 38022)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m	2008-07-03 07:08:48 UTC (rev 38023)
@@ -1,5 +1,5 @@
 /*
- *	$Id:$
+ *	$Id$
  *	MacPorts.Framework
  *
  *	Authors:
@@ -79,6 +79,7 @@
 	STAssertNotNil(searchResults, @"This dictionary should have at least %d key value pairs", [searchResults count]);
 }
 
+
 -(void) testSync {
 	//The only way to test this that I know of is to listen for the posted notifications
 	//and take actions as appropriate
@@ -104,7 +105,6 @@
 		NSLog(@"MacPortsSyncStarted");
 	else
 		NSLog(@"MacPortsSyncFinished"); 
-	NSLog(@"I WAZ HERE");
 }	
 
 
@@ -113,4 +113,22 @@
 	STAssertNotNil(version, @"%@ should not be nil", version);
 }
 
+/*-(void) testInstall {
+	NSDictionary * result = [testPort search:@"pyt"];
+	STAssertNotNil(result, @"Search dictionary should not be null");
+	NSArray * aKeys = [result allKeys];
+	//id key = [enuma nextObject];
+	
+	
+	unsigned int a = [aKeys count];
+	NSLog(@"%d size Dictionary", a);
+	//STAssertNotNil(key , @"First object should not be null");
+	
+	/*NSEnumerator * enumerator = [result keyEnumerator];
+	id key = [enumerator nextObject];
+	MPPort * nwPort = [[MPPort alloc] initWithTclListAsString:[result objectForKey:key]];
+	[testPort install:nwPort];
+	[nwPort release];
+}*/
+
 @end

Modified: branches/gsoc08-framework/MacPorts.Framework/init.tcl
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/init.tcl	2008-07-03 02:31:50 UTC (rev 38022)
+++ branches/gsoc08-framework/MacPorts.Framework/init.tcl	2008-07-03 07:08:48 UTC (rev 38023)
@@ -75,7 +75,8 @@
 #Modifying UI initialization to enable notifications
 proc ui_init {priority prefix channels message} {
 
-	notifications send global testMacPortsNotification "INSIDE UI_INIT"
+	#notifications send global "MP $message Notification" "INSIDE UI_INIT"
+	#notifications send global MPpriorityNotification "INSIDE UI_INIT"
 	
     # Get the list of channels.
     try {
@@ -87,9 +88,9 @@
     # Simplify ui_$priority.
     set nbchans [llength $channels]
     if {$nbchans == 0} {
-        proc ::ui_$priority {str} {
-		notifications send global testMacPortstNotification "$prefix\$str"
-		}
+        proc ::ui_$priority {str} 
+		[ 
+		notifications send global "MP $priority Notification" $message ]
     } else {
         try {
             set prefix [ui_prefix $priority]
@@ -101,29 +102,27 @@
                 set chan [lindex $channels 0]
 				
 				#Redefine ui_$priority here to also throw notifications of some sort
-				proc ::ui_$priority {str} {
-					#[subst { puts $chan "$prefix\$str" }]
+				proc ::ui_$priority {str} [
 					subst { puts $chan "$prefix\$str" }
 
 					#Send notifications using NSDistributedNotificationCenter for now
 					#We need a way to name notifications based on given input, using
 					#testMacPortsNotification for now
-					notifications send global testMacPortstNotification "$prefix\$str"
-				}
+					notifications send global "MP $priority Notification" "$str"
+					notifications send global "MP $priority Notification" $message
+				]
 				
 				
             } else {
-			
-			
-                proc ::ui_$priority {str} {
+                proc ::ui_$priority {str} [
 					subst {
 						foreach chan \$channels {
 							puts $chan "$prefix\$str"
 						}
 					}
 					#Should we discriminate based on channel?
-					notifications send global testMacPortsNotification "$prefix\$str"
-				}
+					notifications send global "MP $priority Notification" $message
+				]
             }
 			
         # Call ui_$priority

Modified: branches/gsoc08-framework/MacPorts.Framework/notifications.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/notifications.m	2008-07-03 02:31:50 UTC (rev 38022)
+++ branches/gsoc08-framework/MacPorts.Framework/notifications.m	2008-07-03 07:08:48 UTC (rev 38023)
@@ -88,7 +88,7 @@
 		
 		//For now we return a single element dictionary containing the ui_* log message
 		info = [NSMutableDictionary dictionaryWithCapacity:1];
-		[info setObject:[NSString stringWithString:@"ui_msg"] forKey:[NSString stringWithUTF8String:Tcl_GetString(*objv)]];
+		[info setObject:[NSString stringWithUTF8String:Tcl_GetString(*objv)] forKey:[NSString stringWithString:@"ui_msg"]];
 		
 		if (global != 0) {
 			[[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080703/66ac453e/attachment-0001.html 


More information about the macports-changes mailing list