diff --git a/macosx/Controller.m b/macosx/Controller.m index 1b6cb06fa..72e1c32f6 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -29,7 +29,6 @@ #import "TorrentCell.h" #import "TorrentTableView.h" #import "StringAdditions.h" -#import "Utils.h" #import @@ -1272,17 +1271,17 @@ static void sleepCallBack( void * controller, io_service_t y, } //append or remove ellipsis when needed - NSString * title = [menuItem title]; + NSString * title = [menuItem title], * ellipsis = [NSString ellipsis]; if (active && [fDefaults boolForKey: @"CheckRemove"]) { - if (![title hasSuffix: NS_ELLIPSIS]) - [menuItem setTitle: [title stringByAppendingString: NS_ELLIPSIS]]; + if (![title hasSuffix: ellipsis]) + [menuItem setTitle: [title stringByAppendingEllipsis]]; } else { - if ([title hasSuffix: NS_ELLIPSIS]) + if ([title hasSuffix: ellipsis]) [menuItem setTitle: [title substringToIndex: - [title rangeOfString: NS_ELLIPSIS].location]]; + [title rangeOfString: ellipsis].location]]; } return canUseMenu && [fTableView numberOfSelectedRows] > 0; } diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index ebcd4cd56..aeb7917e1 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -24,7 +24,6 @@ #import "PrefsController.h" #import "StringAdditions.h" -#import "Utils.h" #define MIN_PORT 1 #define MAX_PORT 65535 @@ -472,10 +471,10 @@ [panel setCanChooseFiles: NO]; [panel setCanChooseDirectories: YES]; - [panel beginSheetForDirectory: NULL file: NULL types: NULL + [panel beginSheetForDirectory: nil file: nil types: nil modalForWindow: [self window] modalDelegate: self didEndSelector: @selector( folderSheetClosed:returnCode:contextInfo: ) - contextInfo: NULL]; + contextInfo: nil]; } @end diff --git a/macosx/StringAdditions.h b/macosx/StringAdditions.h index a5556de83..7a1aa2d68 100644 --- a/macosx/StringAdditions.h +++ b/macosx/StringAdditions.h @@ -26,6 +26,9 @@ @interface NSString (StringAdditions) ++ (NSString *) ellipsis; +- (NSString *) stringByAppendingEllipsis; + + (NSString *) stringWithInt: (int) value; + (NSString *) stringForFileSize: (uint64_t) size; diff --git a/macosx/StringAdditions.m b/macosx/StringAdditions.m index ff546ba88..224278a76 100644 --- a/macosx/StringAdditions.m +++ b/macosx/StringAdditions.m @@ -23,10 +23,19 @@ *****************************************************************************/ #import "StringAdditions.h" -#import "Utils.h" @implementation NSString (StringAdditions) ++ (NSString *) ellipsis +{ + return [NSString stringWithUTF8String: "\xE2\x80\xA6"]; +} + +- (NSString *) stringByAppendingEllipsis +{ + return [self stringByAppendingString: [NSString ellipsis]]; +} + + (NSString *) stringWithInt: (int) value { return [NSString stringWithFormat: @"%d", value]; @@ -114,7 +123,7 @@ if( realWidth <= width ) return [[[NSAttributedString alloc] initWithString: self attributes: attributes] autorelease]; - float ellipsisWidth = [NS_ELLIPSIS sizeWithAttributes: attributes].width; + float ellipsisWidth = [[NSString ellipsis] sizeWithAttributes: attributes].width; /* Width is too small */ if ( ellipsisWidth > width ) @@ -150,7 +159,7 @@ } else; - return [[[NSAttributedString alloc] initWithString: [newString stringByAppendingString: NS_ELLIPSIS] + return [[[NSAttributedString alloc] initWithString: [newString stringByAppendingEllipsis] attributes: attributes] autorelease]; } diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 03a3a1c33..0b5d4a042 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -24,7 +24,6 @@ #import "Torrent.h" #import "StringAdditions.h" -#import "Utils.h" @interface Torrent (Private) @@ -167,7 +166,7 @@ break; case TR_STATUS_CHECK: - [fStatusString setString: [@"Checking existing files" stringByAppendingString: NS_ELLIPSIS]]; + [fStatusString setString: [@"Checking existing files" stringByAppendingEllipsis]]; break; case TR_STATUS_DOWNLOAD: @@ -202,7 +201,7 @@ break; case TR_STATUS_STOPPING: - [fStatusString setString: [@"Stopping" stringByAppendingString: NS_ELLIPSIS]]; + [fStatusString setString: [@"Stopping" stringByAppendingEllipsis]]; break; } @@ -364,7 +363,7 @@ break; case TR_STATUS_CHECK: - return [@"Checking existing files" stringByAppendingString: NS_ELLIPSIS]; + return [@"Checking existing files" stringByAppendingEllipsis]; break; case TR_STATUS_DOWNLOAD: @@ -376,7 +375,7 @@ break; case TR_STATUS_STOPPING: - return [@"Stopping" stringByAppendingString: NS_ELLIPSIS]; + return [@"Stopping" stringByAppendingEllipsis]; break; default: diff --git a/macosx/Utils.h b/macosx/Utils.h deleted file mode 100644 index e44005e90..000000000 --- a/macosx/Utils.h +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Copyright (c) 2005-2006 Transmission authors and contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - *****************************************************************************/ - -#define NS_ELLIPSIS [NSString stringWithUTF8String: "\xE2\x80\xA6"] -#define OSX_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \ - @"/System/Library/CoreServices/SystemVersion.plist"] \ - objectForKey: @"ProductVersion"] floatValue]