[67951] branches/gsoc10-gui/Pallet
tzikis at macports.org
tzikis at macports.org
Sat May 22 11:09:44 PDT 2010
Revision: 67951
http://trac.macports.org/changeset/67951
Author: tzikis at macports.org
Date: 2010-05-22 11:09:39 -0700 (Sat, 22 May 2010)
Log Message:
-----------
Added Growl support for all operations (except Cancel). Yay
Modified Paths:
--------------
branches/gsoc10-gui/Pallet/Growl Registration Ticket.growlRegDict
branches/gsoc10-gui/Pallet/MPActionLauncher.h
branches/gsoc10-gui/Pallet/MPActionLauncher.m
Modified: branches/gsoc10-gui/Pallet/Growl Registration Ticket.growlRegDict
===================================================================
--- branches/gsoc10-gui/Pallet/Growl Registration Ticket.growlRegDict 2010-05-22 17:47:56 UTC (rev 67950)
+++ branches/gsoc10-gui/Pallet/Growl Registration Ticket.growlRegDict 2010-05-22 18:09:39 UTC (rev 67951)
@@ -9,9 +9,9 @@
<string>InstallCompleted</string>
<string>InstallFailed</string>
<string>UpgradeCompleted</string>
- <string>UgrdadeFailed</string>
- <string>RemoveCompleted</string>
- <string>RemoveFailed</string>
+ <string>UgradeFailed</string>
+ <string>UninstallCompleted</string>
+ <string>UninstallFailed</string>
<string>SelfupdateCompleted</string>
<string>SelfupdateFailed</string>
<string>SyncCompleted</string>
Modified: branches/gsoc10-gui/Pallet/MPActionLauncher.h
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionLauncher.h 2010-05-22 17:47:56 UTC (rev 67950)
+++ branches/gsoc10-gui/Pallet/MPActionLauncher.h 2010-05-22 18:09:39 UTC (rev 67951)
@@ -15,13 +15,23 @@
#import <Cocoa/Cocoa.h>
#import <MacPorts/MacPorts.h>
+#import <Growl/Growl.h>
+/* Defining growl types*/
+
+/**/
+#define GROWL_TYPES 5
+#define GROWL_INSTALL 1
+#define GROWL_UNINSTALL 2
+#define GROWL_UPGRADE 3
+#define GROWL_SYNC 4
+#define GROWL_SELFUPDATE 5
/*!
@class MPActionLauncher
@abstract Wrapper for MacPorts Framework actions
@discussion Contains a shared per thread MacPorts Framework wrapper
*/
- at interface MPActionLauncher : NSObject {
+ at interface MPActionLauncher : NSObject <GrowlApplicationBridgeDelegate> {
NSArray *ports;
NSTask *actionTool;
NSConnection *connectionToActionTool;
@@ -82,4 +92,6 @@
- (void)cancelPortProcess;
+-(void) sendGrowlNotification: (int) type;
+
@end
Modified: branches/gsoc10-gui/Pallet/MPActionLauncher.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionLauncher.m 2010-05-22 17:47:56 UTC (rev 67950)
+++ branches/gsoc10-gui/Pallet/MPActionLauncher.m 2010-05-22 18:09:39 UTC (rev 67951)
@@ -51,26 +51,34 @@
NSError * error;
NSArray *empty = [NSArray arrayWithObject: @""];
[port installWithOptions:empty variants:empty error:&error];
+ [self sendGrowlNotification: GROWL_INSTALL];
}
- (void)uninstallPort:(MPPort *)port {
NSError * error;
[port uninstallWithVersion:@"" error:&error];
+ [self sendGrowlNotification: GROWL_UNINSTALL];
}
- (void)upgradePort:(MPPort *)port {
NSError * error;
[port upgradeWithError:&error];
+ [self sendGrowlNotification: GROWL_UPGRADE];
}
- (void)sync {
NSError * error;
[[MPMacPorts sharedInstance] sync:&error];
+ [self sendGrowlNotification: GROWL_SYNC];
}
- (void)selfupdate {
NSError * error;
[[MPMacPorts sharedInstance] selfUpdate:&error];
+ //NSLog(@"yay");
+ //NSInteger code = [error code];
+ //NSLog(@"Selfupdate Error Code %i", code);
+ [self sendGrowlNotification: GROWL_SELFUPDATE];
}
- (void)cancelPortProcess {
@@ -78,4 +86,35 @@
[[MPMacPorts sharedInstance] cancelCurrentCommand];
}
+-(void) sendGrowlNotification:(int)type
+{
+ NSString *growlTitles[GROWL_TYPES];
+ growlTitles[GROWL_INSTALL] = [NSString stringWithString: @"Installation Completed"];
+ growlTitles[GROWL_UNINSTALL] = [NSString stringWithString: @"Uninstall Completed"];
+ growlTitles[GROWL_UPGRADE] = [NSString stringWithString: @"Upgrade Completed"];
+ growlTitles[GROWL_SYNC] = [NSString stringWithString: @"Sync Completed"];
+ growlTitles[GROWL_SELFUPDATE] = [NSString stringWithString: @"Selfupdate Completed"];
+
+ NSString *growlDescriptions[GROWL_TYPES];
+
+ growlDescriptions[GROWL_INSTALL] = [NSString stringWithString: @"Operation completed successfully"];
+ growlDescriptions[GROWL_UNINSTALL] = [NSString stringWithString: @"Operation completed successfully"];
+ growlDescriptions[GROWL_UPGRADE] = [NSString stringWithString: @"Operation completed successfully"];
+ growlDescriptions[GROWL_SYNC] = [NSString stringWithString: @"Operation completed successfully"];
+ growlDescriptions[GROWL_SELFUPDATE] = [NSString stringWithString: @"Operation completed successfully"];
+
+ NSString *growlNotificationNames[GROWL_TYPES];
+
+ growlNotificationNames[GROWL_INSTALL] = [NSString stringWithString: @"InstallCompleted"];
+ growlNotificationNames[GROWL_UNINSTALL] = [NSString stringWithString: @"UninstallCompleted"];
+ growlNotificationNames[GROWL_UPGRADE] = [NSString stringWithString: @"UpgradeCompleted"];
+ growlNotificationNames[GROWL_SYNC] = [NSString stringWithString: @"SyncCompleted"];
+ growlNotificationNames[GROWL_SELFUPDATE] = [NSString stringWithString: @"SelfupdateCompleted"];
+
+ [GrowlApplicationBridge setGrowlDelegate:(id) @""];
+ [GrowlApplicationBridge notifyWithTitle: growlTitles[type] description: growlDescriptions[type]\
+ notificationName:growlNotificationNames[type] iconData:nil priority: 0\
+ isSticky: NO clickContext:nil];
+}
+
@end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100522/0c47269d/attachment-0001.html>
More information about the macports-changes
mailing list