summaryrefslogtreecommitdiff
path: root/src/feeds.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 17:43:49 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 17:43:49 +0200
commit7787cdd1c32ab1f48f5aee50024409702864a2e7 (patch)
tree0aa04bb3f1ef59e4a341fa8c357980e5d7ae6c89 /src/feeds.c
parent57bd24d57826e0fe6ca49b9e378bd2ddb90278c2 (diff)
Feeds: Manual refresh
Diffstat (limited to 'src/feeds.c')
-rw-r--r--src/feeds.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/feeds.c b/src/feeds.c
index 9538d948..1af42477 100644
--- a/src/feeds.c
+++ b/src/feeds.c
@@ -259,7 +259,7 @@ static const iPtrArray *listSubscriptions_(void) {
259 259
260static iBool startWorker_Feeds_(iFeeds *d) { 260static iBool startWorker_Feeds_(iFeeds *d) {
261 if (d->worker) { 261 if (d->worker) {
262 return iFalse; /* Oops? */ 262 return iFalse; /* Refresh is already ongoing. */
263 } 263 }
264 /* Queue up all the subscriptions for the worker. */ 264 /* Queue up all the subscriptions for the worker. */
265 iConstForEach(PtrArray, i, listSubscriptions_()) { 265 iConstForEach(PtrArray, i, listSubscriptions_()) {
@@ -449,6 +449,14 @@ void deinit_Feeds(void) {
449 deinit_SortedArray(&d->entries); 449 deinit_SortedArray(&d->entries);
450} 450}
451 451
452void refresh_Feeds(void) {
453 startWorker_Feeds_(&feeds_);
454}
455
456void refreshFinished_Feeds(void) {
457 stopWorker_Feeds_(&feeds_);
458}
459
452static int cmpTimeDescending_FeedEntryPtr_(const void *a, const void *b) { 460static int cmpTimeDescending_FeedEntryPtr_(const void *a, const void *b) {
453 const iFeedEntry * const *e1 = a, * const *e2 = b; 461 const iFeedEntry * const *e1 = a, * const *e2 = b;
454 return -cmp_Time(&(*e1)->timestamp, &(*e2)->timestamp); 462 return -cmp_Time(&(*e1)->timestamp, &(*e2)->timestamp);
@@ -470,7 +478,7 @@ const iPtrArray *listEntries_Feeds(void) {
470const iString *entryListPage_Feeds(void) { 478const iString *entryListPage_Feeds(void) {
471 iFeeds *d = &feeds_; 479 iFeeds *d = &feeds_;
472 iString *src = collectNew_String(); 480 iString *src = collectNew_String();
473 format_String(src, "# Aggregated Gemini feeds\n"); 481 format_String(src, "# Feed entries\n\n");
474 lock_Mutex(d->mtx); 482 lock_Mutex(d->mtx);
475 const iPtrArray *subs = listSubscriptions_(); 483 const iPtrArray *subs = listSubscriptions_();
476 int elapsed = elapsedSeconds_Time(&d->lastRefreshedAt) / 60; 484 int elapsed = elapsedSeconds_Time(&d->lastRefreshedAt) / 60;