Add preference for articles limit. Closes #2

This commit is contained in:
relikd
2019-03-07 15:10:08 +01:00
parent fc640250d8
commit 55aeea5222
7 changed files with 419 additions and 357 deletions

View File

@@ -106,7 +106,10 @@
/// Generate items for @c FeedArticles menu.
- (void)setArticles:(NSArray<FeedArticle*>*)sortedList forMenu:(NSMenu*)menu {
[menu insertDefaultHeader];
NSUInteger mc = [UserPrefs articlesInMenuLimit];
NSUInteger mc = 0;
if ([UserPrefs defaultNO:@"feedLimitArticles"]) {
mc = [UserPrefs articlesInMenuLimit];
}
for (FeedArticle *fa in sortedList) {
[menu addItem:[fa newMenuItem]];
if (--mc == 0) // if mc==0 then unsigned int will underflow and turn into INT_MAX