From 229d60507b7f37c000416625fe34e0ca86057479 Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Sat, 22 Apr 2006 16:44:56 +0000 Subject: [PATCH] Use NSLog on Mac OS X for errors, cosmetic changes --- macosx/Controller.m | 6 +++--- macosx/Torrent.m | 35 ++++++++++++++--------------------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index e7a2341dc..205405393 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -106,7 +106,7 @@ static void sleepCallBack( void * controller, io_service_t y, kCFRunLoopCommonModes ); } else - printf( "Could not IORegisterForSystemPower\n" ); + NSLog( @"Could not IORegisterForSystemPower" ); NSString * torrentPath, * downloadFolder, * paused; NSDictionary * dic; @@ -1102,7 +1102,7 @@ static void sleepCallBack( void * controller, io_service_t y, appleScript = [[NSAppleScript alloc] initWithSource: growlScript]; if( ![appleScript executeAndReturnError: &error] ) { - printf( "Growl notify failed\n" ); + NSLog( @"Growl notify failed" ); } [appleScript release]; } @@ -1131,7 +1131,7 @@ static void sleepCallBack( void * controller, io_service_t y, appleScript = [[NSAppleScript alloc] initWithSource: growlScript]; if( ![appleScript executeAndReturnError: &error] ) { - printf( "Growl registration failed\n" ); + NSLog( @"Growl registration failed" ); } [appleScript release]; } diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 7cb621d9a..6456eb9ac 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -22,6 +22,7 @@ #import "Torrent.h" #import "StringAdditions.h" +#import "Utils.h" @interface Torrent (Private) @@ -140,33 +141,30 @@ break; case TR_STATUS_STOPPING: - [fStatusString setString: @"Stopping..."]; + [fStatusString setString: [@"Stopping" + stringByAppendingString: NS_ELLIPSIS]]; break; } if( fStat->error & TR_ETRACKER ) { - [fInfoString setString: @"Error: "]; - [fInfoString appendString: [NSString - stringWithUTF8String: fStat->trackerError]]; + [fInfoString setString: [@"Error: " stringByAppendingString: + [NSString stringWithUTF8String: fStat->trackerError]]]; } - [fUploadString setString: @""]; if( fStat->progress == 1.0 ) { - [fDownloadString setString: @"Ratio: "]; - [fDownloadString appendString: [NSString stringForRatio: - fStat->downloaded upload: fStat->uploaded]]; + [fDownloadString setString: [@"Ratio: " stringByAppendingString: + [NSString stringForRatio: fStat->downloaded + upload: fStat->uploaded]]]; } else { - [fDownloadString setString: @"DL: "]; - [fDownloadString appendString: [NSString stringForSpeed: - fStat->rateDownload]]; + [fDownloadString setString: [@"DL: " stringByAppendingString: + [NSString stringForSpeed: fStat->rateDownload]]]; } - [fUploadString setString: @"UL: "]; - [fUploadString appendString: [NSString stringForSpeed: - fStat->rateUpload]]; + [fUploadString setString: [@"UL: " stringByAppendingString: + [NSString stringForSpeed: fStat->rateUpload]]]; } - (void) start @@ -187,14 +185,9 @@ - (void) sleep { - if( fStat->status & TR_STATUS_ACTIVE ) + if( ( fResumeOnWake = ( fStat->status & TR_STATUS_ACTIVE ) ) ) { [self stop]; - fResumeOnWake = YES; - } - else - { - fResumeOnWake = NO; } } @@ -380,7 +373,7 @@ if( ![[NSFileManager defaultManager] removeFileAtPath: path handler: nil] ) { - printf( "Could not trash `%s'\n", [path UTF8String] ); + NSLog( [@"Could not trash " stringByAppendingString: path] ); } } }