Permalink
Browse files

growlplugin 0.7: Made all notifications honor the app's icon by going…

… back to the ticket set in growl

Signed-off-by: Dominik Pich <Dominik@pich.info>
  • Loading branch information...
1 parent 3373019 commit b44c8dd18cae58a8f3cf8c4b8728142ceba6ac5c @Daij-Djan committed Aug 18, 2012
View
BIN .DS_Store
Binary file not shown.
@@ -160,6 +160,9 @@
B4EA1C6915D2BE3A0007B3C8 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
B4EA1C6D15D2BE4C0007B3C8 /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = System/Library/Frameworks/PreferencePanes.framework; sourceTree = SDKROOT; };
B4F06AA8158A9B8500249913 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+ B4F36CEB15E0108600BA22E2 /* GrowlTicketController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowlTicketController.h; sourceTree = "<group>"; };
+ B4F36CED15E0109F00BA22E2 /* GrowlAbstractSingletonObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowlAbstractSingletonObject.h; sourceTree = "<group>"; };
+ B4F36CEE15E010B400BA22E2 /* GrowlApplicationTicket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrowlApplicationTicket.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -290,6 +293,9 @@
isa = PBXGroup;
children = (
B4EA1C4A15D296340007B3C8 /* GrowlDefines.h */,
+ B4F36CEB15E0108600BA22E2 /* GrowlTicketController.h */,
+ B4F36CED15E0109F00BA22E2 /* GrowlAbstractSingletonObject.h */,
+ B4F36CEE15E010B400BA22E2 /* GrowlApplicationTicket.h */,
B4EA1C4B15D296340007B3C8 /* GrowlDefinesInternal.h */,
B4EA1C4C15D296340007B3C8 /* GrowlDisplayPlugin.h */,
B4EA1C4D15D296340007B3C8 /* GrowlNotification.h */,
@@ -10,6 +10,8 @@
#import "NSStringAdditions.h"
#import "GrowlDefinesInternal.h"
#import "GrowlNotification.h"
+#import "GrowlTicketController.h"
+#import "GrowlApplicationTicket.h"
#include <Security/SecKeychain.h>
#include <Security/SecKeychainItem.h>
@@ -29,7 +31,7 @@ - (NSPreferencePane *) preferencePane {
- (void) displayNotification:(GrowlNotification *)notification {
NSString *path = [[NSBundle bundleWithIdentifier:@"com.Growl.MountainNotifier"] pathForResource:@"MountainNotifier" ofType:nil];
-
+
//name
NSString *name = notification.applicationName;
if(!name) {
@@ -67,9 +69,16 @@ - (void) displayNotification:(GrowlNotification *)notification {
//always revert to appicon!
notification.icon = nil;
- id data=[notification.auxiliaryDictionary objectForKey:GROWL_NOTIFICATION_APP_ICON_DATA];
+ id data=[notification.auxiliaryDictionary objectForKey:GROWL_APP_ICON_DATA];
if(!data)
- data=[notification.auxiliaryDictionary objectForKey:GROWL_APP_ICON_DATA];
+ data=[notification.auxiliaryDictionary objectForKey:GROWL_NOTIFICATION_APP_ICON_DATA];
+ if(!data) {
+ NSString *appName = notification.applicationName;
+ if(appName.length) {
+ GrowlApplicationTicket *ticket = [[GrowlTicketController sharedController] ticketForApplicationName:appName hostName:nil];
+ data = ticket.iconData;
+ }
+ }
if(data) {
notification.icon = [[[NSImage alloc] initWithData:data] autorelease];
@@ -82,13 +91,14 @@ - (void) displayNotification:(GrowlNotification *)notification {
[[notification.icon TIFFRepresentation] writeToFile:iconpath atomically:NO];
}
else {
+ //NO ICON - Fallback
iconpath = [[NSBundle mainBundle] pathForResource:@"Growl" ofType:@"icns"];
}
-
+
//launch tool
NSTask *tool = [NSTask launchedTaskWithLaunchPath:path arguments:[NSArray arrayWithObjects:name, title, subtitle, message, iconpath, nil]];
[tool waitUntilExit];
-
+
//if we wrote an icon, clean up
if(notification.icon)
[[NSFileManager defaultManager] removeItemAtPath:iconpath error:nil];
@@ -15,7 +15,7 @@
<key>CFBundleSignature</key>
<string>GRRR</string>
<key>CFBundleVersion</key>
- <string>0.6</string>
+ <string>0.7</string>
<key>CSResourcesFileMapped</key>
<string>yes</string>
<key>NSPrincipalClass</key>
@@ -105,7 +105,7 @@
<object class="NSTextFieldCell" key="NSCell" id="899841572">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">272629760</int>
- <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjYgKDgvMTEvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
+ <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh
YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv
biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp
@@ -61,6 +61,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 244}, {310, 25}}</string>
<reference key="NSSuperview" ref="718972097"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="839680547"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="227144814">
@@ -99,11 +100,12 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 132}, {299, 104}}</string>
<reference key="NSSuperview" ref="718972097"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="899841572">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">272629760</int>
- <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjYgKDgvMTEvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
+ <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh
YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv
biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp
@@ -122,6 +124,7 @@ ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA</string>
</object>
<string key="NSFrameSize">{354, 289}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="376755552"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
@@ -262,7 +265,73 @@ ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA</string>
<nil key="sourceID"/>
<int key="maxID">120</int>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">GrowlMountainNotifierPrefs</string>
+ <string key="superclassName">NSPreferencePane</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/GrowlMountainNotifierPrefs.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSPreferencePane</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>_firstKeyView</string>
+ <string>_initialKeyView</string>
+ <string>_lastKeyView</string>
+ <string>_window</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSView</string>
+ <string>NSView</string>
+ <string>NSView</string>
+ <string>NSWindow</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>_firstKeyView</string>
+ <string>_initialKeyView</string>
+ <string>_lastKeyView</string>
+ <string>_window</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_firstKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_initialKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_lastKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_window</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSPreferencePane.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
@@ -61,6 +61,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 244}, {310, 25}}</string>
<reference key="NSSuperview" ref="718972097"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="839680547"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="227144814">
@@ -99,11 +100,12 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 132}, {299, 104}}</string>
<reference key="NSSuperview" ref="718972097"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="899841572">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">272629760</int>
- <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjYgKDgvMTEvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
+ <string type="base64-UTF8" key="NSContents">dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp
ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh
YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv
biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp
@@ -122,6 +124,7 @@ ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA</string>
</object>
<string key="NSFrameSize">{354, 289}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="376755552"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
@@ -262,7 +265,73 @@ ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA</string>
<nil key="sourceID"/>
<int key="maxID">120</int>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">GrowlMountainNotifierPrefs</string>
+ <string key="superclassName">NSPreferencePane</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/GrowlMountainNotifierPrefs.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSPreferencePane</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>_firstKeyView</string>
+ <string>_initialKeyView</string>
+ <string>_lastKeyView</string>
+ <string>_window</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSView</string>
+ <string>NSView</string>
+ <string>NSView</string>
+ <string>NSWindow</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>_firstKeyView</string>
+ <string>_initialKeyView</string>
+ <string>_lastKeyView</string>
+ <string>_window</string>
+ </object>
+ <object class="NSArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_firstKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_initialKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_lastKeyView</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">_window</string>
+ <string key="candidateClassName">NSWindow</string>
+ </object>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/NSPreferencePane.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
Oops, something went wrong.

0 comments on commit b44c8dd

Please sign in to comment.