Revision: 7582
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7582&view=rev
Author:   hofman
Date:     2011-12-16 21:41:15 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
set key for formatter in initializer

Modified Paths:
--------------
    trunk/SKDictionaryFormatter.h
    trunk/SKDictionaryFormatter.m
    trunk/SKProgressCell.m
    trunk/SKSnapshotPageCell.m
    trunk/SKTextWithIconCell.m

Modified: trunk/SKDictionaryFormatter.h
===================================================================
--- trunk/SKDictionaryFormatter.h       2011-12-16 21:34:28 UTC (rev 7581)
+++ trunk/SKDictionaryFormatter.h       2011-12-16 21:41:15 UTC (rev 7582)
@@ -42,5 +42,7 @@
 @interface SKDictionaryFormatter : NSFormatter {
     NSString *key;
 }
-@property (nonatomic, retain) NSString *key;
+
+- (id)initWithKey:(NSString *)aKey;
+
 @end

Modified: trunk/SKDictionaryFormatter.m
===================================================================
--- trunk/SKDictionaryFormatter.m       2011-12-16 21:34:28 UTC (rev 7581)
+++ trunk/SKDictionaryFormatter.m       2011-12-16 21:41:15 UTC (rev 7582)
@@ -41,19 +41,33 @@
 
 @implementation SKDictionaryFormatter
 
-@synthesize key;
+- (id)init {
+    return [self initWithKey:nil];
+}
 
+- (id)initWithKey:(NSString *)aKey {
+    if (aKey == nil) {
+        [self release];
+        return nil;
+    }
+    self = [super init];
+    if (self) {
+        key = [aKey retain];
+    }
+    return self;
+}
+
 - (void)dealloc {
     SKDESTROY(key);
     [super dealloc];
 }
 
 - (NSString *)stringForObjectValue:(id)obj {
-    return [obj respondsToSelector:@selector(objectForKey:)] ? [obj 
objectForKey:key ?: @""] : nil;
+    return [obj respondsToSelector:@selector(objectForKey:)] ? [obj 
objectForKey:key] : nil;
 }
 
 - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string 
errorDescription:(NSString **)error {
-    *obj = [NSDictionary dictionaryWithObjectsAndKeys:[[string copy] 
autorelease], key ?: @"", nil];
+    *obj = [NSDictionary dictionaryWithObjectsAndKeys:[[string copy] 
autorelease], key, nil];
     return YES;
 }
 

Modified: trunk/SKProgressCell.m
===================================================================
--- trunk/SKProgressCell.m      2011-12-16 21:34:28 UTC (rev 7581)
+++ trunk/SKProgressCell.m      2011-12-16 21:41:15 UTC (rev 7582)
@@ -55,8 +55,7 @@
 
 + (void)initialize {
     SKINITIALIZE;
-    progressCellFormatter = [[SKDictionaryFormatter alloc] init];
-    [progressCellFormatter setKey:SKDownloadFileNameKey];
+    progressCellFormatter = [[SKDictionaryFormatter alloc] 
initWithKey:SKDownloadFileNameKey];
     
 }
 

Modified: trunk/SKSnapshotPageCell.m
===================================================================
--- trunk/SKSnapshotPageCell.m  2011-12-16 21:34:28 UTC (rev 7581)
+++ trunk/SKSnapshotPageCell.m  2011-12-16 21:41:15 UTC (rev 7582)
@@ -49,8 +49,7 @@
 
 + (void)initialize {
     SKINITIALIZE;
-    snapshotPageCellFormatter = [[SKDictionaryFormatter alloc] init];
-    [snapshotPageCellFormatter setKey:SKSnapshotPageCellLabelKey];
+    snapshotPageCellFormatter = [[SKDictionaryFormatter alloc] 
initWithKey:SKSnapshotPageCellLabelKey];
 }
 
 - (id)initTextCell:(NSString *)aString {

Modified: trunk/SKTextWithIconCell.m
===================================================================
--- trunk/SKTextWithIconCell.m  2011-12-16 21:34:28 UTC (rev 7581)
+++ trunk/SKTextWithIconCell.m  2011-12-16 21:41:15 UTC (rev 7582)
@@ -55,8 +55,7 @@
 
 + (void)initialize {
     SKINITIALIZE;
-    textWithIconCellFormatter = [[SKDictionaryFormatter alloc] init];
-    [textWithIconCellFormatter setKey:SKTextWithIconStringKey];
+    textWithIconCellFormatter = [[SKDictionaryFormatter alloc] 
initWithKey:SKTextWithIconStringKey];
 }
 
 - (void)commonInit {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to