Revision: 14726
http://sourceforge.net/p/skim-app/code/14726
Author: hofman
Date: 2024-11-18 16:50:36 +0000 (Mon, 18 Nov 2024)
Log Message:
-----------
Don't update persistent data for downloads when nothing has changed
Modified Paths:
--------------
trunk/SKDownloadController.h
trunk/SKDownloadController.m
Modified: trunk/SKDownloadController.h
===================================================================
--- trunk/SKDownloadController.h 2024-11-18 15:41:55 UTC (rev 14725)
+++ trunk/SKDownloadController.h 2024-11-18 16:50:36 UTC (rev 14726)
@@ -55,6 +55,7 @@
NSURLSession *session;
NSMapTable<NSURLSessionTask *, SKDownload *> *downloadsForTasks;
NSMutableDictionary<NSString *, NSCustomTouchBarItem *> *touchBarItems;
+ BOOL needsSaving;
}
@property (nonatomic, nullable, strong) IBOutlet SKTableView *tableView;
Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m 2024-11-18 15:41:55 UTC (rev 14725)
+++ trunk/SKDownloadController.m 2024-11-18 16:50:36 UTC (rev 14726)
@@ -149,9 +149,11 @@
}
- (void)handleApplicationWillTerminateNotification:(NSNotification
*)notification {
- [downloads makeObjectsPerformSelector:@selector(cancel) withObject:nil];
- NSDictionary *downloadsDictionary = @{DOWNLOADS_KEY:[downloads
valueForKey:@"properties"]};
- [[NSUserDefaults standardUserDefaults]
setPersistentDomain:downloadsDictionary forName:SKDownloadsIdentifier];
+ if (needsSaving) {
+ [downloads makeObjectsPerformSelector:@selector(cancel)
withObject:nil];
+ NSDictionary *downloadsDictionary = @{DOWNLOADS_KEY:[downloads
valueForKey:@"properties"]};
+ [[NSUserDefaults standardUserDefaults]
setPersistentDomain:downloadsDictionary forName:SKDownloadsIdentifier];
+ }
}
- (void)updateClearButton {
@@ -219,6 +221,8 @@
[download start];
[self updateClearButton];
+
+ needsSaving = YES;
}
- (void)removeDownloadsAtIndexes:(NSIndexSet *)indexes {
@@ -236,6 +240,8 @@
[tableView endUpdates];
[self updateClearButton];
+
+ needsSaving = YES;
}
#pragma mark Adding/Removing Downloads
@@ -511,6 +517,7 @@
[[QLPreviewPanel sharedPreviewPanel] reloadData];
}
}
+ needsSaving = YES;
}
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit