summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/feeds.c13
-rw-r--r--src/ui/util.c1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/feeds.c b/src/feeds.c
index 93bec891..87fd0d67 100644
--- a/src/feeds.c
+++ b/src/feeds.c
@@ -85,7 +85,8 @@ iDefineTypeConstructionArgs(FeedJob, (const iBookmark *bm), bm)
85 85
86/*----------------------------------------------------------------------------------------------*/ 86/*----------------------------------------------------------------------------------------------*/
87 87
88static const char *feedsFilename_Feeds_ = "feeds.txt"; 88static const char *feedsFilename_Feeds_ = "feeds.txt";
89static const int updateIntervalSeconds_Feeds_ = 2 * 60 * 60;
89 90
90struct Impl_Feeds { 91struct Impl_Feeds {
91 iMutex * mtx; 92 iMutex * mtx;
@@ -273,7 +274,7 @@ static iBool startWorker_Feeds_(iFeeds *d) {
273static uint32_t refresh_Feeds_(uint32_t interval, void *data) { 274static uint32_t refresh_Feeds_(uint32_t interval, void *data) {
274 /* Called in the SDL timer thread, so let's start a worker thread for running the update. */ 275 /* Called in the SDL timer thread, so let's start a worker thread for running the update. */
275 startWorker_Feeds_(&feeds_); 276 startWorker_Feeds_(&feeds_);
276 return 1000 * 60 * 60; 277 return 1000 * updateIntervalSeconds_Feeds_;
277} 278}
278 279
279static void stopWorker_Feeds_(iFeeds *d) { 280static void stopWorker_Feeds_(iFeeds *d) {
@@ -419,7 +420,13 @@ void init_Feeds(const char *saveDir) {
419 init_PtrArray(&d->jobs); 420 init_PtrArray(&d->jobs);
420 init_SortedArray(&d->entries, sizeof(iFeedEntry *), cmp_FeedEntryPtr_); 421 init_SortedArray(&d->entries, sizeof(iFeedEntry *), cmp_FeedEntryPtr_);
421 load_Feeds_(d); 422 load_Feeds_(d);
422 d->refreshTimer = SDL_AddTimer(5000, refresh_Feeds_, NULL); 423 /* Update feeds if it has been a while. */
424 int intervalSec = updateIntervalSeconds_Feeds_;
425 if (isValid_Time(&d->lastRefreshedAt)) {
426 const double elapsed = elapsedSeconds_Time(&d->lastRefreshedAt);
427 intervalSec = iMax(1, updateIntervalSeconds_Feeds_ - elapsed);
428 }
429 d->refreshTimer = SDL_AddTimer(1000 * intervalSec, refresh_Feeds_, NULL);
423} 430}
424 431
425void deinit_Feeds(void) { 432void deinit_Feeds(void) {
diff --git a/src/ui/util.c b/src/ui/util.c
index 541cf5d6..ef88d989 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -368,6 +368,7 @@ iWidget *addAction_Widget(iWidget *parent, int key, int kmods, const char *comma
368 368
369static iBool isCommandIgnoredByMenus_(const char *cmd) { 369static iBool isCommandIgnoredByMenus_(const char *cmd) {
370 return equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.player.update") || 370 return equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.player.update") ||
371 startsWith_CStr(cmd, "feeds.update.") ||
371 equal_Command(cmd, "document.request.updated") || equal_Command(cmd, "window.resized") || 372 equal_Command(cmd, "document.request.updated") || equal_Command(cmd, "window.resized") ||
372 (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */ 373 (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */
373} 374}