diff --git a/README.md b/README.md
index a8ddd26..f09ee7f 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,11 @@ With this Terminal command you can customize this number:
3) If you hold down the option key and click on an article item, you can mark a single item (un-)read.
+4) Limit number of displayed articles in feed menu.
+**Note:** unread count for feed and group may be different than the unread items inside (if unread articles are omitted).
+
+```defaults write de.relikd.baRSS articlesInMenuLimit -int 40```
+
ToDo
diff --git a/baRSS/Info.plist b/baRSS/Info.plist
index 6d76a70..412f020 100644
--- a/baRSS/Info.plist
+++ b/baRSS/Info.plist
@@ -32,7 +32,7 @@
CFBundleVersion
- 1047
+ 1078
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
LSUIElement
diff --git a/baRSS/Preferences/General Tab/UserPrefs.h b/baRSS/Preferences/General Tab/UserPrefs.h
index d318f01..42ae594 100644
--- a/baRSS/Preferences/General Tab/UserPrefs.h
+++ b/baRSS/Preferences/General Tab/UserPrefs.h
@@ -32,4 +32,5 @@
+ (NSUInteger)openFewLinksLimit; // Change with: 'defaults write de.relikd.baRSS openFewLinksLimit -int 10'
+ (NSUInteger)shortArticleNamesLimit; // Change with: 'defaults write de.relikd.baRSS shortArticleNamesLimit -int 50'
++ (NSUInteger)articlesInMenuLimit; // Change with: 'defaults write de.relikd.baRSS articlesInMenuLimit -int 40'
@end
diff --git a/baRSS/Preferences/General Tab/UserPrefs.m b/baRSS/Preferences/General Tab/UserPrefs.m
index 6293f06..bff6a12 100644
--- a/baRSS/Preferences/General Tab/UserPrefs.m
+++ b/baRSS/Preferences/General Tab/UserPrefs.m
@@ -67,14 +67,19 @@
#pragma mark - Hidden Plist Properties -
-/// @return The limit on how many links should be opened at the same time, if user holds the option key.
+/// @return The limit on how many links should be opened at the same time, if user holds the option key. Default: @c 10
+ (NSUInteger)openFewLinksLimit {
return (NSUInteger)[self defaultInt:10 forKey:@"openFewLinksLimit"];
}
-/// @return The limit on when to truncate article titles (Short names setting must be active).
+/// @return The limit on when to truncate article titles (Short names setting must be active). Default: @c 60
+ (NSUInteger)shortArticleNamesLimit {
return (NSUInteger)[self defaultInt:60 forKey:@"shortArticleNamesLimit"];
}
+/// @return The maximum number of articles displayed per feed. Default: @c 0 (no limitation)
++ (NSUInteger)articlesInMenuLimit {
+ return (NSUInteger)[self defaultInt:0 forKey:@"articlesInMenuLimit"];
+}
+
@end
diff --git a/baRSS/Status Bar Menu/BarMenu.m b/baRSS/Status Bar Menu/BarMenu.m
index 5a1cbc2..971705a 100644
--- a/baRSS/Status Bar Menu/BarMenu.m
+++ b/baRSS/Status Bar Menu/BarMenu.m
@@ -22,6 +22,7 @@
#import "BarMenu.h"
#import "Constants.h"
+#import "UserPrefs.h"
#import "NSMenu+Ext.h"
#import "BarStatusItem.h"
#import "MapUnreadTotal.h"
@@ -105,8 +106,11 @@
/// Generate items for @c FeedArticles menu.
- (void)setArticles:(NSArray*)sortedList forMenu:(NSMenu*)menu {
[menu insertDefaultHeader];
+ NSUInteger 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
+ break;
}
UnreadTotal *uct = self.unreadMap[menu.titleIndexPath];
[menu setHeaderHasUnread:(uct.unread > 0) hasRead:(uct.unread < uct.total)];