Revision: 4425
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4425&view=rev
Author:   hofman
Date:     2008-08-18 19:30:09 +0000 (Mon, 18 Aug 2008)

Log Message:
-----------
Remove some unneeded methods from bookmark class cluster

Modified Paths:
--------------
    trunk/SKBookmark.m

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2008-08-18 19:05:47 UTC (rev 4424)
+++ trunk/SKBookmark.m  2008-08-18 19:30:09 UTC (rev 4425)
@@ -64,6 +64,7 @@
     unsigned int pageIndex;
     NSDictionary *setup;
 }
+- (id)initWithAlias:(BDAlias *)anAlias pageIndex:(unsigned)aPageIndex 
label:(NSString *)aLabel;
 - (BDAlias *)alias;
 - (NSData *)aliasData;
 @end
@@ -202,7 +203,7 @@
 }
 
 - (id)initWithPath:(NSString *)aPath pageIndex:(unsigned)aPageIndex 
label:(NSString *)aLabel {
-    return [self initWithAlias:[BDAlias aliasWithPath:aPath] 
pageIndex:aPageIndex label:aLabel];
+    return [[SKFileBookmark alloc] initWithAlias:[BDAlias aliasWithPath:aPath] 
pageIndex:aPageIndex label:aLabel];
 }
 
 - (id)initWithSetup:(NSDictionary *)aSetupDict label:(NSString *)aLabel {
@@ -214,11 +215,11 @@
 }
 
 - (id)initFolderWithLabel:(NSString *)aLabel {
-    return [self initFolderWithChildren:[NSArray array] label:aLabel];
+    return [self initFolderWithChildren:nil label:aLabel];
 }
 
 - (id)initSessionWithChildren:(NSArray *)aChildren label:(NSString *)aLabel {
-    return [[SKSessionBookmark alloc] initSessionWithChildren:aChildren 
label:aLabel];
+    return [[SKSessionBookmark alloc] initFolderWithChildren:aChildren 
label:aLabel];
 }
 
 - (id)initSeparator {
@@ -227,24 +228,18 @@
 
 - (id)initWithProperties:(NSDictionary *)dictionary {
     NSString *type = [dictionary objectForKey:SKBookmarkTypeKey];
-    if ([type isEqualToString:SKBookmarkTypeFolderString]) {
+    if ([type isEqualToString:SKBookmarkTypeSeparatorString]) {
+        return [[SKSeparatorBookmark alloc] init];
+    } else if ([type isEqualToString:SKBookmarkTypeFolderString] || [type 
isEqualToString:SKBookmarkTypeSessionString]) {
+        Class bookmarkClass = [type 
isEqualToString:SKBookmarkTypeFolderString] ? [SKFolderBookmark class] : 
[SKSessionBookmark class];
         NSEnumerator *dictEnum = [[dictionary 
objectForKey:SKBookmarkChildrenKey] objectEnumerator];
         NSDictionary *dict;
         NSMutableArray *newChildren = [NSMutableArray array];
         while (dict = [dictEnum nextObject])
-            [newChildren addObject:[[[[self class] alloc] 
initWithProperties:dict] autorelease]];
-        return [self initFolderWithChildren:newChildren label:[dictionary 
objectForKey:SKBookmarkLabelKey]];
-    } else if ([type isEqualToString:SKBookmarkTypeSeparatorString]) {
-        return [self initSeparator];
-    } else if ([type isEqualToString:SKBookmarkTypeSessionString]) {
-        NSEnumerator *dictEnum = [[dictionary 
objectForKey:SKBookmarkChildrenKey] objectEnumerator];
-        NSDictionary *dict;
-        NSMutableArray *newChildren = [NSMutableArray array];
-        while (dict = [dictEnum nextObject])
-            [newChildren addObject:[[[[self class] alloc] 
initWithProperties:dict] autorelease]];
-        return [self initSessionWithChildren:newChildren label:[dictionary 
objectForKey:SKBookmarkLabelKey]];
+            [newChildren addObject:[[[SKBookmark alloc] 
initWithProperties:dict] autorelease]];
+        return [[bookmarkClass alloc] initFolderWithChildren:newChildren 
label:[dictionary objectForKey:SKBookmarkLabelKey]];
     } else {
-        return [self initWithAlias:[BDAlias aliasWithData:[dictionary 
objectForKey:SKBookmarkAliasDataKey]] pageIndex:[[dictionary 
objectForKey:SKBookmarkPageIndexKey] unsignedIntValue] label:[dictionary 
objectForKey:SKBookmarkLabelKey]];
+        return [[SKFileBookmark alloc] initWithAlias:[BDAlias 
aliasWithData:[dictionary objectForKey:SKBookmarkAliasDataKey]] 
pageIndex:[[dictionary objectForKey:SKBookmarkPageIndexKey] unsignedIntValue] 
label:[dictionary objectForKey:SKBookmarkLabelKey]];
     }
 }
 
@@ -381,7 +376,7 @@
 - (id)initFolderWithChildren:(NSArray *)aChildren label:(NSString *)aLabel {
     if (self = [super init]) {
         label = [aLabel copy];
-        children = [aChildren mutableCopy];
+        children = [[NSMutableArray alloc] initWithArray:aChildren];
         [children makeObjectsPerformSelector:@selector(setParent:) 
withObject:self];
     }
     return self;
@@ -452,10 +447,6 @@
 
 @implementation SKSessionBookmark
 
-- (id)initSessionWithChildren:(NSArray *)aChildren label:(NSString *)aLabel {
-    return [super initFolderWithChildren:aChildren label:aLabel];
-}
-
 - (NSDictionary *)properties {
     return [NSDictionary 
dictionaryWithObjectsAndKeys:SKBookmarkTypeSessionString, SKBookmarkTypeKey, 
[children valueForKey:SKBookmarkPropertiesKey], SKBookmarkChildrenKey, label, 
SKBookmarkLabelKey, nil];
 }


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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to