Limit number of article items. Issue #2
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1047</string>
|
||||
<string>1078</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>LSUIElement</key>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<FeedArticle*>*)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)];
|
||||
|
||||
Reference in New Issue
Block a user