adium 2439:dfea1a2fe3f2: Add a Growl event option to set the pri...
commits at adium.im
commits at adium.im
Mon Jun 1 18:17:15 UTC 2009
details: http://hg.adium.im/adium/rev/dfea1a2fe3f2
revision: 2439:dfea1a2fe3f2
author: Zachary West <zacw at adium.im>
date: Mon Jun 01 14:17:04 2009 -0400
Add a Growl event option to set the priority (Very Low, Moderate, High, High, Emergency). Fixes #2295.
diffs (514 lines):
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Resources/GrowlAlert.nib/classes.nib
--- a/Resources/GrowlAlert.nib/classes.nib Mon Jun 01 13:59:05 2009 -0400
+++ b/Resources/GrowlAlert.nib/classes.nib Mon Jun 01 14:17:04 2009 -0400
@@ -1,56 +1,243 @@
-{
- IBClasses = (
- {
- CLASS = AIActionDetailsPane;
- LANGUAGE = ObjC;
- SUPERCLASS = AIModularPane;
- },
- {
- CLASS = AILocalizationButton;
- LANGUAGE = ObjC;
- OUTLETS = {
- "view_anchorToLeftSide" = NSView;
- "view_anchorToRightSide" = NSView;
- "window_anchorOnLeftSide" = NSWindow;
- "window_anchorOnRightSide" = NSWindow;
- };
- SUPERCLASS = NSButton;
- },
- {
- ACTIONS = {
- changePreference = id;
- };
- CLASS = AIModularPane;
- LANGUAGE = ObjC;
- OUTLETS = {
- plugin = id;
- view = NSView;
- };
- SUPERCLASS = AIObject;
- },
- {
- CLASS = AIObject;
- LANGUAGE = ObjC;
- SUPERCLASS = NSObject;
- },
- {
- CLASS = CBGrowlAlertDetailPane;
- LANGUAGE = ObjC;
- OUTLETS = {
- "checkBox_sticky" = NSButton;
- };
- SUPERCLASS = AIActionDetailsPane;
- },
- {
- CLASS = FirstResponder;
- LANGUAGE = ObjC;
- SUPERCLASS = NSObject;
- },
- {
- CLASS = NSButton;
- LANGUAGE = ObjC;
- SUPERCLASS = NSControl;
- }
- );
- IBVersion = 1;
-}
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>NSApplication</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>RBSplitView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>delegate</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>RBSplitSubview</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSTextField</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSControl</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>RBSplitSubview</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSMenu</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>adiumPrint</key>
+ <string>id</string>
+ <key>didAdjustSubviews</key>
+ <string>RBSplitView</string>
+ <key>prefsWindowWillClose</key>
+ <string>SS_PrefsController</string>
+ <key>toggleFindPanel</key>
+ <string>id</string>
+ <key>willAdjustSubviews</key>
+ <string>RBSplitView</string>
+ </dict>
+ <key>CLASS</key>
+ <string>NSObject</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>AILocalizationButton</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>view_anchorToLeftSide</key>
+ <string>NSView</string>
+ <key>view_anchorToRightSide</key>
+ <string>NSView</string>
+ <key>window_anchorOnLeftSide</key>
+ <string>NSWindow</string>
+ <key>window_anchorOnRightSide</key>
+ <string>NSWindow</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSButton</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSWindow</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>AIActionDetailsPane</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>AIModularPane</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSResponder</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSMenuItem</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>changePreference</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>AIModularPane</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>plugin</key>
+ <string>id</string>
+ <key>view</key>
+ <string>NSView</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>CBGrowlAlertDetailPane</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>checkBox_sticky</key>
+ <string>NSButton</string>
+ <key>label_priority</key>
+ <string>NSTextField</string>
+ <key>popUp_priority</key>
+ <string>NSPopUpButton</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>AIActionDetailsPane</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSButton</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSControl</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSPopUpButton</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSButton</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSPopUpButtonCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSMenuItemCell</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>AILocalizationTextField</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>view_anchorToLeftSide</key>
+ <string>NSView</string>
+ <key>view_anchorToRightSide</key>
+ <string>NSView</string>
+ <key>window_anchorOnLeftSide</key>
+ <string>NSWindow</string>
+ <key>window_anchorOnRightSide</key>
+ <string>NSWindow</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSTextField</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSButtonCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSActionCell</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>SS_PrefsController</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>delegate</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <string>1</string>
+</dict>
+</plist>
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Resources/GrowlAlert.nib/info.nib
--- a/Resources/GrowlAlert.nib/info.nib Mon Jun 01 13:59:05 2009 -0400
+++ b/Resources/GrowlAlert.nib/info.nib Mon Jun 01 14:17:04 2009 -0400
@@ -2,22 +2,19 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>IBDocumentLocation</key>
- <string>81 124 356 240 0 0 1440 878 </string>
- <key>IBEditorPositions</key>
- <dict>
- <key>5</key>
- <string>435 634 570 56 0 0 1440 878 </string>
- </dict>
<key>IBFramework Version</key>
- <string>482.0</string>
+ <string>677</string>
+ <key>IBLastKnownRelativeProjectPath</key>
+ <string>../Adium.xcodeproj</string>
+ <key>IBOldestOS</key>
+ <integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
- <string>9B18</string>
- <key>IBUsesTextArchiving</key>
- <true/>
+ <string>9J61</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
</dict>
</plist>
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Resources/GrowlAlert.nib/keyedobjects.nib
Binary file Resources/GrowlAlert.nib/keyedobjects.nib has changed
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Source/CBGrowlAlertDetailPane.h
--- a/Source/CBGrowlAlertDetailPane.h Mon Jun 01 13:59:05 2009 -0400
+++ b/Source/CBGrowlAlertDetailPane.h Mon Jun 01 14:17:04 2009 -0400
@@ -17,7 +17,10 @@
#import <Adium/AIActionDetailsPane.h>
@interface CBGrowlAlertDetailPane : AIActionDetailsPane {
- IBOutlet NSButton *checkBox_sticky;
+ IBOutlet NSButton *checkBox_sticky;
+
+ IBOutlet NSTextField *label_priority;
+ IBOutlet NSPopUpButton *popUp_priority;
}
@end
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Source/CBGrowlAlertDetailPane.m
--- a/Source/CBGrowlAlertDetailPane.m Mon Jun 01 13:59:05 2009 -0400
+++ b/Source/CBGrowlAlertDetailPane.m Mon Jun 01 14:17:04 2009 -0400
@@ -17,6 +17,12 @@
#import "CBGrowlAlertDetailPane.h"
#import "NEHGrowlPlugin.h"
+#import <AIUtilities/AIMenuAdditions.h>
+
+ at interface CBGrowlAlertDetailPane()
+- (NSMenu *)priorityMenu;
+ at end
+
/*!
* @class CBGrowlAlertDetailPane
* @brief Provide and manage custom controls for configuring the Growl contact alert
@@ -52,14 +58,65 @@
[super viewDidLoad];
[checkBox_sticky setLocalizedString:AILocalizedString(@"Sticky","Growl contact alert label")];
+ [label_priority setLocalizedString:AILocalizedString(@"Priority:", "Priority label for Growl")];
+
+ [popUp_priority setMenu:[self priorityMenu]];
}
/*!
+ * @brief The priority menu
+ *
+ * @return A menu of elements with Name (Tag) as follows: Very Low (-2), Moderate (-1), Normal (0), High (1), Emergency (2).
+ */
+- (NSMenu *)priorityMenu
+{
+ NSMenu *menu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
+
+ [menu addItemWithTitle:AILocalizedString(@"Very Low", "Growl priority")
+ target:self
+ action:@selector(dummyAction)
+ keyEquivalent:@""
+ tag:-2];
+
+ [menu addItemWithTitle:AILocalizedString(@"Moderate", "Growl priority")
+ target:self
+ action:@selector(dummyAction)
+ keyEquivalent:@""
+ tag:-1];
+
+ [menu addItemWithTitle:AILocalizedString(@"Normal", "Growl priority")
+ target:self
+ action:@selector(dummyAction)
+ keyEquivalent:@""
+ tag:0];
+
+ [menu addItemWithTitle:AILocalizedString(@"High", "Growl priority")
+ target:self
+ action:@selector(dummyAction)
+ keyEquivalent:@""
+ tag:1];
+
+ [menu addItemWithTitle:AILocalizedString(@"Emergency", "Growl priority")
+ target:self
+ action:@selector(dummyAction)
+ keyEquivalent:@""
+ tag:2];
+
+ return [menu autorelease];
+}
+
+/*!
+ * @brief Does nothing.
+ */
+- (void)dummyAction {}
+
+/*!
* @brief Load the state of our controls
*/
- (void)configureForActionDetails:(NSDictionary *)inDetails listObject:(AIListObject *)inObject
{
[checkBox_sticky setState:([[inDetails objectForKey:KEY_GROWL_ALERT_STICKY] boolValue] ? NSOnState : NSOffState)];
+ [popUp_priority selectItemWithTag:[[inDetails objectForKey:KEY_GROWL_PRIORITY] integerValue]];
}
/*!
@@ -67,8 +124,9 @@
*/
- (NSDictionary *)actionDetails
{
- return [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:([checkBox_sticky state] == NSOnState)]
- forKey:KEY_GROWL_ALERT_STICKY];
+ return [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:([checkBox_sticky state] == NSOnState)], KEY_GROWL_ALERT_STICKY,
+ [NSNumber numberWithInteger:[popUp_priority selectedItem].tag], KEY_GROWL_PRIORITY, nil];
}
/*!
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Source/NEHGrowlPlugin.h
--- a/Source/NEHGrowlPlugin.h Mon Jun 01 13:59:05 2009 -0400
+++ b/Source/NEHGrowlPlugin.h Mon Jun 01 14:17:04 2009 -0400
@@ -18,6 +18,7 @@
#import <Growl-WithInstaller/GrowlApplicationBridge.h>
#define KEY_GROWL_ALERT_STICKY @"Growl Sticky"
+#define KEY_GROWL_PRIORITY @"Growl Priority"
#define GROWL_QUEUE_WAIT 0.75 // Seconds to wait before clearing an event type's queue
@protocol GrowlApplicationBridgeDelegate;
diff -r 2a6e8ec43901 -r dfea1a2fe3f2 Source/NEHGrowlPlugin.m
--- a/Source/NEHGrowlPlugin.m Mon Jun 01 13:59:05 2009 -0400
+++ b/Source/NEHGrowlPlugin.m Mon Jun 01 14:17:04 2009 -0400
@@ -68,6 +68,7 @@
- (void)postMultipleEventID:(NSString *)eventID
sticky:(BOOL)sticky
+ priority:(NSInteger)priority
forListObject:(AIListObject *)listObject
forChat:(AIChat *)chat
withCount:(NSUInteger)count;
@@ -312,11 +313,15 @@
AILog(@"Posting multiple event - %@ %@ %@ %d", eventID, overallListObject, chat, events.count);
// Use any random event for sticky.
- BOOL sticky = [[[[events objectAtIndex:0] objectForKey:@"Details"] objectForKey:KEY_GROWL_ALERT_STICKY] boolValue];
+ NSDictionary *anyEventDetails = [[events objectAtIndex:0] objectForKey:@"Details"];
+
+ BOOL sticky = [[anyEventDetails objectForKey:KEY_GROWL_ALERT_STICKY] boolValue];
+ NSInteger priority = [[anyEventDetails objectForKey:KEY_GROWL_PRIORITY] integerValue];
// Post the events combined. Use any random event to see if sticky.
[self postMultipleEventID:eventID
sticky:sticky
+ priority:priority
forListObject:overallListObject
forChat:chat
withCount:events.count];
@@ -445,7 +450,7 @@
description:description
notificationName:eventID
iconData:iconData
- priority:0
+ priority:[[details objectForKey:KEY_GROWL_PRIORITY] integerValue]
isSticky:[[details objectForKey:KEY_GROWL_ALERT_STICKY] boolValue]
clickContext:clickContext
identifier:identifier];
@@ -453,6 +458,7 @@
- (void)postMultipleEventID:(NSString *)eventID
sticky:(BOOL)sticky
+ priority:(NSInteger)priority
forListObject:(AIListObject *)listObject
forChat:(AIChat *)chat
withCount:(NSUInteger)count
@@ -533,7 +539,7 @@
description:description
notificationName:eventID
iconData:iconData
- priority:0
+ priority:priority
isSticky:sticky
clickContext:clickContext
identifier:identifier];
More information about the commits
mailing list