Unread indicator for groups

This commit is contained in:
relikd
2019-10-03 18:02:38 +02:00
parent ae18e93b6a
commit 850351a966
6 changed files with 27 additions and 20 deletions

View File

@@ -246,6 +246,7 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
- (void)setTitleCount:(NSUInteger)count {
if (self.tag == TagTitleCountVisible) {
self.tag = 0; // clear mask
self.state = NSControlStateValueOff;
NSUInteger loc = [self.title rangeOfString:@" (" options:NSLiteralSearch | NSBackwardsSearch].location;
if (loc != NSNotFound)
self.title = [self.title substringToIndex:loc];
@@ -253,6 +254,9 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
if (count > 0 && UserPrefsBool(self.submenu.isFeedMenu ? Pref_feedUnreadCount : Pref_groupUnreadCount)) {
self.tag = TagTitleCountVisible; // apply new mask
self.title = [self.title stringByAppendingFormat:@" (%ld)", count];
self.onStateImage = [NSImage imageNamed:RSSImageMenuItemUnread];
if (UserPrefsBool(Pref_groupUnreadIndicator))
self.state = NSControlStateValueOn;
}
}