diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-12 17:38:44 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-12 17:38:44 +0200 |
commit | 6b8cb273ad31f01251b1363b11d12982ec63a419 (patch) | |
tree | 477e1dd371984b9ff1efed59c4db6d80ea3cf8b0 /src/ui/sidebarwidget.c | |
parent | 1abe34f7a061932f4bf433c3e99b804588272536 (diff) |
SidebarWidget: Limit to 100 feed entries
Not including separators.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index c31e157c..db00209f 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -141,16 +141,12 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
141 | init_Date(&on, &now); | 141 | init_Date(&on, &now); |
142 | const int thisYear = on.year; | 142 | const int thisYear = on.year; |
143 | iZap(on); | 143 | iZap(on); |
144 | size_t numItems = 0; | ||
144 | iConstForEach(PtrArray, i, listEntries_Feeds()) { | 145 | iConstForEach(PtrArray, i, listEntries_Feeds()) { |
145 | const iFeedEntry *entry = i.ptr; | 146 | const iFeedEntry *entry = i.ptr; |
146 | if (isHidden_FeedEntry(entry)) { | 147 | if (isHidden_FeedEntry(entry)) { |
147 | continue; /* A hidden entry. */ | 148 | continue; /* A hidden entry. */ |
148 | } | 149 | } |
149 | /* For more items, one can always see "about:feeds". A large number of items | ||
150 | is a bit difficult to navigate in the sidebar. */ | ||
151 | if (numItems_ListWidget(d->list) == 100) { | ||
152 | break; | ||
153 | } | ||
154 | /* Exclude entries that are too old for Visited to keep track of. */ | 150 | /* Exclude entries that are too old for Visited to keep track of. */ |
155 | if (secondsSince_Time(&now, &entry->discovered) > maxAge_Visited) { | 151 | if (secondsSince_Time(&now, &entry->discovered) > maxAge_Visited) { |
156 | break; /* the rest are even older */ | 152 | break; /* the rest are even older */ |
@@ -185,6 +181,11 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
185 | } | 181 | } |
186 | addItem_ListWidget(d->list, item); | 182 | addItem_ListWidget(d->list, item); |
187 | iRelease(item); | 183 | iRelease(item); |
184 | if (++numItems == 100) { | ||
185 | /* For more items, one can always see "about:feeds". A large number of items | ||
186 | is a bit difficult to navigate in the sidebar. */ | ||
187 | break; | ||
188 | } | ||
188 | } | 189 | } |
189 | d->menu = makeMenu_Widget( | 190 | d->menu = makeMenu_Widget( |
190 | as_Widget(d), | 191 | as_Widget(d), |