Revision: 14683 http://sourceforge.net/p/skim-app/code/14683 Author: hofman Date: 2024-11-14 15:08:31 +0000 (Thu, 14 Nov 2024) Log Message: ----------- Allow setting 0 for max recent documents to register none
Modified Paths: -------------- trunk/SKBookmarkController.m Modified: trunk/SKBookmarkController.m =================================================================== --- trunk/SKBookmarkController.m 2024-11-13 17:13:19 UTC (rev 14682) +++ trunk/SKBookmarkController.m 2024-11-14 15:08:31 UTC (rev 14683) @@ -121,7 +121,7 @@ + (void)initialize { SKINITIALIZE; - maxRecentDocumentsCount = [[NSUserDefaults standardUserDefaults] integerForKey:SKMaximumDocumentPageHistoryCountKey] ?: 50; + maxRecentDocumentsCount = [([[NSUserDefaults standardUserDefaults] objectForKey:SKMaximumDocumentPageHistoryCountKey] ?: @50) integerValue]; SKBookmarksIdentifier = [[[NSBundle mainBundle] bundleIdentifier] stringByAppendingString:@".bookmarks"]; @@ -154,10 +154,12 @@ bookmarksCache = [bookmarkDictionary objectForKey:BOOKMARKS_KEY]; recentDocuments = [[NSMutableArray alloc] init]; - for (NSDictionary *dict in [bookmarkDictionary objectForKey:RECENTDOCUMENTS_KEY]) { - SKBookmark *bm = [[SKBookmark alloc] initWithProperties:dict]; - if (bm) - [recentDocuments addObject:bm]; + if (maxRecentDocumentsCount > 0) { + for (NSDictionary *dict in [bookmarkDictionary objectForKey:RECENTDOCUMENTS_KEY]) { + SKBookmark *bm = [[SKBookmark alloc] initWithProperties:dict]; + if (bm) + [recentDocuments addObject:bm]; + } } bookmarkRoot = [[SKBookmark alloc] initRootWithChildrenProperties:bookmarksCache]; @@ -247,7 +249,7 @@ } - (BOOL)addRecentDocumentForURL:(NSURL *)fileURL pageIndex:(NSUInteger)pageIndex snapshots:(NSArray *)snapshots { - if (fileURL) { + if (maxRecentDocumentsCount > 0 && fileURL) { SKBookmark *info = [[SKBookmark alloc] initWithURL:fileURL pageIndex:pageIndex snapshots:snapshots label:nil]; if (info) { SKBookmark *oldInfo = [self recentDocumentAtURL:fileURL]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit