Changeset 594
- Timestamp:
- Jul 15, 2006, 11:13:21 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 15 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Transmission.xcodeproj/project.pbxproj
r593 r594 110 110 A25FCDEF0A3769A6002BCBBE /* PauseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDD0A37695F002BCBBE /* PauseSelected.png */; }; 111 111 A25FCDF00A3769AC002BCBBE /* ResumeSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */; }; 112 A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; }; 113 A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; }; 112 114 A26D450B0A0503AC00A10BB3 /* peermessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1838A309DEC0430047D688 /* peermessages.h */; }; 113 115 A27431DB0A68538400FA780A /* BarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* BarButton.m */; }; … … 152 154 dstSubfolderSpec = 10; 153 155 files = ( 156 A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */, 154 157 A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */, 155 158 ); … … 250 253 4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; }; 251 254 4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; }; 252 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };255 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; }; 253 256 4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; }; 254 257 4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; }; … … 306 309 A25FCDDD0A37695F002BCBBE /* PauseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseSelected.png; path = macosx/Images/PauseSelected.png; sourceTree = "<group>"; }; 307 310 A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeSelected.png; path = macosx/Images/ResumeSelected.png; sourceTree = "<group>"; }; 311 A261F1DB0A69A1610002815A /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; }; 308 312 A27431D80A68538400FA780A /* BarButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = BarButton.h; path = macosx/BarButton.h; sourceTree = "<group>"; }; 309 313 A27431D90A68538400FA780A /* BarButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = BarButton.m; path = macosx/BarButton.m; sourceTree = "<group>"; }; … … 352 356 4D4B7F6109E055660053C1EB /* libcrypto.0.9.dylib in Frameworks */, 353 357 A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */, 358 A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */, 354 359 ); 355 360 runOnlyForDeploymentPostprocessing = 0; … … 568 573 isa = PBXGroup; 569 574 children = ( 575 A261F1DB0A69A1610002815A /* Growl.framework */, 570 576 A24F19070A3A790800C9C145 /* Sparkle.framework */, 571 577 ); … … 896 902 "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", 897 903 "$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)", 904 "$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)", 898 905 ); 899 906 FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)\""; 900 907 FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)\""; 908 FRAMEWORK_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)\""; 901 909 GCC_PRECOMPILE_PREFIX_HEADER = YES; 902 910 GCC_PREFIX_HEADER = macosx/Transmission_Prefix.pch; -
trunk/macosx/Controller.h
r581 r594 84 84 NSMutableArray * fAutoImportedNames; 85 85 86 BOOL f HasGrowl, fUpdateInProgress;86 BOOL fUpdateInProgress; 87 87 Badger * fBadger; 88 88 } 89 89 90 90 - (void) openShowSheet: (id) sender; 91 - (void) openSheetClosed: (NSOpenPanel *) s returnCode: (int) code 92 contextInfo: (void *) info; 91 - (void) openSheetClosed: (NSOpenPanel *) s returnCode: (int) code contextInfo: (void *) info; 93 92 94 - (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode 95 contextInfo: (void *) contextInfo; 93 - (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo; 96 94 97 95 - (NSArray *) torrentsAtIndexes: (NSIndexSet *) indexSet; … … 162 160 - (void) autoImportChange: (NSNotification *) notification; 163 161 164 - (void) sleepCallBack: (natural_t) messageType argument: 165 (void *) messageArgument; 162 - (void) sleepCallBack: (natural_t) messageType argument: (void *) messageArgument; 166 163 167 164 - (void) toggleSmallView: (id) sender; … … 178 175 - (void) linkForums: (id) sender; 179 176 180 - (void) notifyGrowl: (NSString *) title message: (NSString *) message identifier: (NSString *) ident;181 - (void) growlRegister;182 183 177 - (void) checkUpdate: (id) sender; 184 178 - (void) prepareForUpdate: (NSNotification *) notification; -
trunk/macosx/Controller.m
r587 r594 32 32 33 33 #import <Sparkle/Sparkle.h> 34 #import <Growl/GrowlApplicationBridge.h> 34 35 35 36 #define TOOLBAR_OPEN @"Toolbar Open" … … 49 50 #define FORUM_URL @"http://transmission.m0k.org/forum/" 50 51 51 #define GROWL_PATH @"/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app"52 53 52 static void sleepCallBack(void * controller, io_service_t y, 54 53 natural_t messageType, void * messageArgument) … … 75 74 fBadger = [[Badger alloc] init]; 76 75 77 //check and register Growl if it is installed for this user or all users 78 NSFileManager * manager = [NSFileManager defaultManager]; 79 fHasGrowl = [manager fileExistsAtPath: GROWL_PATH] 80 || [manager fileExistsAtPath: [NSHomeDirectory() stringByAppendingPathComponent: GROWL_PATH]]; 81 [self growlRegister]; 76 [GrowlApplicationBridge setGrowlDelegate: self]; 82 77 } 83 78 return self; … … 833 828 [self checkToStartWaiting: torrent]; 834 829 835 //notifications 836 [self notifyGrowl: @"Download Complete" message: [[torrent name] stringByAppendingString: 837 @" finished downloading"] identifier: @"Download Complete"]; 830 [GrowlApplicationBridge notifyWithTitle: @"Download Complete" 831 description: [torrent name] notificationName: @"Download Complete" iconData: nil 832 priority: 0 isSticky: NO clickContext: nil]; 833 838 834 if (![fWindow isKeyWindow]) 839 835 fCompleted++; … … 1223 1219 [fInfoController updateInfoStatsAndSettings]; 1224 1220 1225 [self notifyGrowl: @"Seeding Complete" message: [[[notification object] name] stringByAppendingString: 1226 @" finished seeding"] identifier: @"Seeding Complete"]; 1221 [GrowlApplicationBridge notifyWithTitle: @"Seeding Complete" 1222 description: [[notification object] name] notificationName: @"Seeding Complete" 1223 iconData: nil priority: 0 isSticky: NO clickContext: nil]; 1227 1224 } 1228 1225 … … 1331 1328 //import only actually happened if the torrent array is larger 1332 1329 if (oldCount < [fTorrents count]) 1333 [self notifyGrowl: @"Torrent File Auto Added" message: [file stringByAppendingString: 1334 @" added to Transmission"] identifier: @"Torrent Auto Added"]; 1330 [GrowlApplicationBridge notifyWithTitle: @"Torrent File Auto Added" 1331 description: file notificationName: @"Torrent Auto Added" iconData: nil 1332 priority: 0 isSticky: NO clickContext: nil]; 1335 1333 } 1336 1334 } … … 1991 1989 } 1992 1990 1993 - (void) notifyGrowl: (NSString *) title message: (NSString *) message identifier: (NSString *) ident1994 {1995 if (!fHasGrowl)1996 return;1997 1998 NSString * growlScript = [NSString stringWithFormat:1999 @"tell application \"System Events\"\n"2000 " if exists application process \"GrowlHelperApp\" then\n"2001 " tell application \"GrowlHelperApp\"\n "2002 " notify with name \"%@\""2003 " title \"%@\""2004 " description \"%@\""2005 " application name \"Transmission\"\n"2006 " end tell\n"2007 " end if\n"2008 "end tell", ident, title, message];2009 2010 NSAppleScript * appleScript = [[NSAppleScript alloc] initWithSource: growlScript];2011 NSDictionary * error;2012 if (![appleScript executeAndReturnError: & error])2013 NSLog(@"Growl notify failed");2014 [appleScript release];2015 }2016 2017 - (void) growlRegister2018 {2019 if (!fHasGrowl)2020 return;2021 2022 NSString * growlScript = @"tell application \"System Events\"\n"2023 " if exists application process \"GrowlHelperApp\" then\n"2024 " tell application \"GrowlHelperApp\"\n"2025 " register as application \"Transmission\" "2026 " all notifications {\"Download Complete\", \"Seeding Complete\", \"Torrent Auto Added\"}"2027 " default notifications {\"Download Complete\", \"Seeding Complete\", \"Torrent Auto Added\"}"2028 " icon of application \"Transmission\"\n"2029 " end tell\n"2030 " end if\n"2031 "end tell";2032 2033 NSAppleScript * appleScript = [[NSAppleScript alloc] initWithSource: growlScript];2034 NSDictionary * error;2035 if (![appleScript executeAndReturnError: & error])2036 NSLog(@"Growl registration failed");2037 [appleScript release];2038 }2039 2040 1991 - (void) checkUpdate: (id) sender 2041 1992 { … … 2048 1999 } 2049 2000 2001 - (NSDictionary *) registrationDictionaryForGrowl 2002 { 2003 NSArray * notifications = [NSArray arrayWithObjects: @"Download Complete", 2004 @"Seeding Complete", @"Torrent Auto Added", nil]; 2005 return [NSDictionary dictionaryWithObjectsAndKeys: notifications, GROWL_NOTIFICATIONS_ALL, 2006 notifications, GROWL_NOTIFICATIONS_DEFAULT, nil]; 2007 } 2008 2050 2009 @end
Note: See TracChangeset
for help on using the changeset viewer.