diff options
Diffstat (limited to 'src/feeds.c')
-rw-r--r-- | src/feeds.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/feeds.c b/src/feeds.c index 73c68987..db426994 100644 --- a/src/feeds.c +++ b/src/feeds.c | |||
@@ -381,7 +381,8 @@ static iThreadResult fetch_Feeds_(iThread *thread) { | |||
381 | } | 381 | } |
382 | initCurrent_Time(&d->lastRefreshedAt); | 382 | initCurrent_Time(&d->lastRefreshedAt); |
383 | save_Feeds_(d); | 383 | save_Feeds_(d); |
384 | postCommandf_App("feeds.update.finished arg:%d", gotNew ? 1 : 0); | 384 | postCommandf_App("feeds.update.finished arg:%d unread:%zu", gotNew ? 1 : 0, |
385 | numUnread_Feeds()); | ||
385 | return 0; | 386 | return 0; |
386 | } | 387 | } |
387 | 388 | ||
@@ -624,6 +625,18 @@ size_t numSubscribed_Feeds(void) { | |||
624 | return size_PtrArray(listSubscriptions_()); | 625 | return size_PtrArray(listSubscriptions_()); |
625 | } | 626 | } |
626 | 627 | ||
628 | size_t numUnread_Feeds(void) { | ||
629 | size_t count = 0; | ||
630 | size_t max = 100; /* match the number of items shown in the sidebar */ | ||
631 | iConstForEach(PtrArray, i, listEntries_Feeds()) { | ||
632 | if (!max--) break; | ||
633 | if (isUnread_FeedEntry(i.ptr)) { | ||
634 | count++; | ||
635 | } | ||
636 | } | ||
637 | return count; | ||
638 | } | ||
639 | |||
627 | #define iPluralS(c) ((c) != 1 ? "s" : "") | 640 | #define iPluralS(c) ((c) != 1 ? "s" : "") |
628 | 641 | ||
629 | const iString *entryListPage_Feeds(void) { | 642 | const iString *entryListPage_Feeds(void) { |