[38068] branches/gsoc08-framework/MacPorts.Framework
armahg at macports.org
armahg at macports.org
Sat Jul 5 06:36:22 PDT 2008
Revision: 38068
http://trac.macosforge.org/projects/macports/changeset/38068
Author: armahg at macports.org
Date: 2008-07-05 06:36:22 -0700 (Sat, 05 Jul 2008)
Log Message:
-----------
Cleaned up code in notifications.m
Modified Paths:
--------------
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.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m 2008-07-05 13:24:00 UTC (rev 38067)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m 2008-07-05 13:36:22 UTC (rev 38068)
@@ -109,6 +109,9 @@
-(void) testVersion {
+
+ [[[NSWorkspace sharedWorkspace] notificationCenter] postNotificationName:@"Test Version"
+ object:nil];
NSString * version = [testPort version];
STAssertNotNil(version, @"%@ should not be nil", version);
}
Modified: branches/gsoc08-framework/MacPorts.Framework/init.tcl
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/init.tcl 2008-07-05 13:24:00 UTC (rev 38067)
+++ branches/gsoc08-framework/MacPorts.Framework/init.tcl 2008-07-05 13:36:22 UTC (rev 38068)
@@ -76,7 +76,7 @@
proc ui_init {priority prefix channels message} {
#notifications send global "MP $message Notification" "INSIDE UI_INIT"
- #notifications send global MPpriorityNotification "INSIDE UI_INIT"
+ notifications send MPpriorityNotification "INSIDE UI_INIT"
# Get the list of channels.
try {
@@ -108,7 +108,6 @@
#Send notifications using NSDistributedNotificationCenter for now
#We need a way to name notifications based on given input, using
#testMacPortsNotification for now
- notifications send global "MP $priority Notification" "$str"
notifications send global "MP $priority Notification" $message
]
Modified: branches/gsoc08-framework/MacPorts.Framework/notifications.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/notifications.m 2008-07-05 13:24:00 UTC (rev 38067)
+++ branches/gsoc08-framework/MacPorts.Framework/notifications.m 2008-07-05 13:36:22 UTC (rev 38068)
@@ -39,13 +39,6 @@
#include <Cocoa/Cocoa.h>
int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *interpreter) {
- /*/Debugging code starts here
- NSLog(@"Inside Notifications_Send!");
- if(*objv) {
- NSLog(@"size of STUFF is %d", objc);
- }
- //Debugging code ends here*/
-
NSString *name = nil;
NSMutableDictionary *info = nil;
@@ -54,42 +47,17 @@
int i;
const char **tclElements;
-
- /*/Debugging code starts here
- if(*objv) {
- NSLog(@"*objv pointer for name is NOT NULL");
- }
- //Debugging code ends here*/
-
name = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
++objv; --objc;
- /*/Debugging code starts here
- if(*objv) {
- NSLog(@"*objv pointer for Tcl_SplitList is NOT NULL, name is %@", name);
- }
- //Debugging code ends here*/
-
tclResult = Tcl_SplitList(interpreter, Tcl_GetString(*objv), &tclCount, &tclElements);
if (tclResult == TCL_OK) {
- /*/Debugging code starts here
- if(*objv) {
- NSLog(@"size of Dictionary is %d", tclCount);
- }
- for(i = 0; tclElements[i] != NULL; i++) {
- NSLog(@"Element in Dictionary is %@", [NSString stringWithUTF8String:tclElements[i]]);
- }
- for(i = 0; i < tclCount; i++) {
- NSLog(@"Element in Dictionary is %@", [NSString stringWithUTF8String:tclElements[i]]);
- }
- //Debugging code ends here*/
-
-
//For now we return a single element dictionary containing the ui_* log message
info = [NSMutableDictionary dictionaryWithCapacity:1];
[info setObject:[NSString stringWithUTF8String:Tcl_GetString(*objv)] forKey:[NSString stringWithString:@"ui_msg"]];
+ //Afaik local notifications don't work. I'm keeping code for it in case we find a work around
if (global != 0) {
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
} else {
@@ -97,17 +65,19 @@
}
-
/*
- info = [NSMutableDictionary dictionaryWithCapacity:(tclCount / 2)];
- for (i = 0; i < tclCount; i +=2) {
- [info setObject:[NSString stringWithUTF8String:tclElements[i + 1]] forKey:[NSString stringWithUTF8String:tclElements[i]]];
- }
- if (global != 0) {
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
- } else {
- [[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
- }*/
+ I don't understand what Randall's original intent was for parsing the ui_msg as an NSDictionary.
+ I'll keep this code here till further notice.
+
+ info = [NSMutableDictionary dictionaryWithCapacity:(tclCount / 2)];
+ for (i = 0; i < tclCount; i +=2) {
+ [info setObject:[NSString stringWithUTF8String:tclElements[i + 1]] forKey:[NSString stringWithUTF8String:tclElements[i]]];
+ }
+ if (global != 0) {
+ [[NSDistributedNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ } else {
+ [[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:info];
+ }*/
} else {
return TCL_ERROR;
}
@@ -116,10 +86,6 @@
}
int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int objc, Tcl_Obj *CONST objv[]) {
- //Debugging code starts here
- //NSLog(@"Inside Notifications_Command!");
- //Debugging code ends here
-
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *action = nil;
int returnCode = TCL_ERROR;
@@ -130,13 +96,6 @@
action = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
++objv, --objc;
if ([action isEqualToString:@"send"]) {
-
- /*/Debugging code starts here
- //if(*objv) {
- NSLog(@"*objv pointer in Notifications_Command is NOT NULL");
- }
- //Debugging code ends here*/
-
if ([[NSString stringWithUTF8String:Tcl_GetString(*objv)] isEqualToString:@"global"]) {
++objv, --objc;
returnCode = Notifications_Send(objc, objv, 1, interpreter);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080705/2ebdbd4e/attachment.html
More information about the macports-changes
mailing list