Add new power icons for battery, AC adapter, and charging from AC adapter. Includes the original Opacity document that generates these icons.
1.1 --- a/Extras/HardwareGrowler/AppController.m Tue Apr 28 05:13:41 2009 -0700
1.2 +++ b/Extras/HardwareGrowler/AppController.m Tue May 05 00:40:54 2009 -0700
1.3 @@ -185,6 +185,60 @@
1.4 return iSyncIconData;
1.5 }
1.6
1.7 +static CFDataRef powerBatteryIcon(void)
1.8 +{
1.9 + static CFDataRef batteryIconData = NULL;
1.10 + char imagePath[PATH_MAX];
1.11 +
1.12 + if (!batteryIconData) {
1.13 + CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
1.14 + CFSTR("Power-Battery"),
1.15 + CFSTR("png"),
1.16 + /*subDirName*/ NULL);
1.17 + if (CFURLGetFileSystemRepresentation(imageURL, false, (UInt8 *)imagePath, sizeof(imagePath)))
1.18 + batteryIconData = (CFDataRef)readFile(imagePath);
1.19 + CFRelease(imageURL);
1.20 + }
1.21 +
1.22 + return batteryIconData;
1.23 +}
1.24 +
1.25 +static CFDataRef powerACIcon(void)
1.26 +{
1.27 + static CFDataRef ACPowerIconData = NULL;
1.28 + char imagePath[PATH_MAX];
1.29 +
1.30 + if (!ACPowerIconData) {
1.31 + CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
1.32 + CFSTR("Power-AC"),
1.33 + CFSTR("png"),
1.34 + /*subDirName*/ NULL);
1.35 + if (CFURLGetFileSystemRepresentation(imageURL, false, (UInt8 *)imagePath, sizeof(imagePath)))
1.36 + ACPowerIconData = (CFDataRef)readFile(imagePath);
1.37 + CFRelease(imageURL);
1.38 + }
1.39 +
1.40 + return ACPowerIconData;
1.41 +}
1.42 +
1.43 +static CFDataRef powerACChargingIcon(void)
1.44 +{
1.45 + static CFDataRef ACChargingPowerIconData = NULL;
1.46 + char imagePath[PATH_MAX];
1.47 +
1.48 + if (!ACChargingPowerIconData) {
1.49 + CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),
1.50 + CFSTR("Power-ACCharging"),
1.51 + CFSTR("png"),
1.52 + /*subDirName*/ NULL);
1.53 + if (CFURLGetFileSystemRepresentation(imageURL, false, (UInt8 *)imagePath, sizeof(imagePath)))
1.54 + ACChargingPowerIconData = (CFDataRef)readFile(imagePath);
1.55 + CFRelease(imageURL);
1.56 + }
1.57 +
1.58 + return ACChargingPowerIconData;
1.59 +}
1.60 +
1.61 #pragma mark Firewire
1.62
1.63 void AppController_fwDidConnect(CFStringRef deviceName) {
1.64 @@ -483,7 +537,7 @@
1.65 NSString *title = nil;
1.66 NSMutableString *description = [NSMutableString string];
1.67 NSString *notificationName = nil;
1.68 - CFDataRef imageData = iSyncIcon();
1.69 + CFDataRef imageData = NULL;
1.70
1.71 BOOL haveBatteryTime = (batteryTime != -1);
1.72 BOOL haveBatteryPercentage = (batteryPercentage != -1);
1.73 @@ -497,6 +551,9 @@
1.74 if (haveBatteryTime) [description appendFormat:NSLocalizedString(@"Time to charge: %i", nil), batteryTime];
1.75 if (haveBatteryTime && haveBatteryPercentage) [description appendString:@"\n"];
1.76 if (haveBatteryPercentage) [description appendFormat:NSLocalizedString(@"Current charge: %d%%", nil), batteryPercentage];
1.77 + imageData = powerACChargingIcon();
1.78 + } else {
1.79 + imageData = powerACIcon();
1.80 }
1.81
1.82 notificationName = (NSString *)NotifierPowerOnACNotification;
1.83 @@ -510,6 +567,8 @@
1.84
1.85 notificationName = (NSString *)NotifierPowerOnBatteryNotification;
1.86
1.87 + imageData = powerBatteryIcon();
1.88 +
1.89 } else if (powerSource == HGUPSPower) {
1.90 title = NSLocalizedString(@"On UPS power", nil);
1.91
2.1 --- a/Extras/HardwareGrowler/HardwareGrowler.xcodeproj/project.pbxproj Tue Apr 28 05:13:41 2009 -0700
2.2 +++ b/Extras/HardwareGrowler/HardwareGrowler.xcodeproj/project.pbxproj Tue May 05 00:40:54 2009 -0700
2.3 @@ -23,6 +23,9 @@
2.4
2.5 /* Begin PBXBuildFile section */
2.6 179B92900C14D110004FB187 /* VolumeNotifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 179B928F0C14D110004FB187 /* VolumeNotifier.m */; };
2.7 + 315CBFB90FB009AE00458E96 /* Power-AC.png in Resources */ = {isa = PBXBuildFile; fileRef = 315CBFB70FB009AE00458E96 /* Power-AC.png */; };
2.8 + 315CBFBA0FB009AE00458E96 /* Power-Battery.png in Resources */ = {isa = PBXBuildFile; fileRef = 315CBFB80FB009AE00458E96 /* Power-Battery.png */; };
2.9 + 315CBFF30FB0213C00458E96 /* Power-ACCharging.png in Resources */ = {isa = PBXBuildFile; fileRef = 315CBFF20FB0213C00458E96 /* Power-ACCharging.png */; };
2.10 3423607209D8888A009FF634 /* PowerNotifier.c in Sources */ = {isa = PBXBuildFile; fileRef = 3423607009D8888A009FF634 /* PowerNotifier.c */; };
2.11 345BD6330C8B12B8005C3DA2 /* NetworkNotifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 345BD6320C8B12B8005C3DA2 /* NetworkNotifier.m */; };
2.12 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
2.13 @@ -200,6 +203,9 @@
2.14 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
2.15 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2.16 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
2.17 + 315CBFB70FB009AE00458E96 /* Power-AC.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Power-AC.png"; sourceTree = "<group>"; };
2.18 + 315CBFB80FB009AE00458E96 /* Power-Battery.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Power-Battery.png"; sourceTree = "<group>"; };
2.19 + 315CBFF20FB0213C00458E96 /* Power-ACCharging.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Power-ACCharging.png"; sourceTree = "<group>"; };
2.20 32CA4F630368D1EE00C91783 /* HardwareNotifier_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HardwareNotifier_Prefix.pch; sourceTree = "<group>"; };
2.21 3423606F09D8888A009FF634 /* PowerNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerNotifier.h; sourceTree = "<group>"; };
2.22 3423607009D8888A009FF634 /* PowerNotifier.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = PowerNotifier.c; sourceTree = "<group>"; };
2.23 @@ -354,6 +360,9 @@
2.24 DDF9B70607BC1D5D0007B5B7 /* usbLogoWhite.png */,
2.25 DDF9B6FA07BC1C800007B5B7 /* usbLogo.png */,
2.26 DDF9B6D007BC16E30007B5B7 /* FireWireLogo.png */,
2.27 + 315CBFB70FB009AE00458E96 /* Power-AC.png */,
2.28 + 315CBFF20FB0213C00458E96 /* Power-ACCharging.png */,
2.29 + 315CBFB80FB009AE00458E96 /* Power-Battery.png */,
2.30 8D1107310486CEB800E47090 /* Info.plist */,
2.31 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
2.32 29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
2.33 @@ -582,6 +591,9 @@
2.34 DD1E135C07C923FD005BD5FC /* Credits.rtf in Resources */,
2.35 950626470840CB8200C01CD2 /* BluetoothLogo.png in Resources */,
2.36 95AC163C0858A3BF008213B8 /* Localizable.strings in Resources */,
2.37 + 315CBFB90FB009AE00458E96 /* Power-AC.png in Resources */,
2.38 + 315CBFBA0FB009AE00458E96 /* Power-Battery.png in Resources */,
2.39 + 315CBFF30FB0213C00458E96 /* Power-ACCharging.png in Resources */,
2.40 );
2.41 runOnlyForDeploymentPostprocessing = 0;
2.42 };
3.1 Binary file Extras/HardwareGrowler/Power-AC.png has changed
4.1 Binary file Extras/HardwareGrowler/Power-ACCharging.png has changed
5.1 Binary file Extras/HardwareGrowler/Power-Battery.png has changed
6.1 Binary file Extras/HardwareGrowler/Power.opacity has changed