Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Long <self@brendanlong.com>2017-10-29 16:56:40 +0300
committerBrendan Long <self@brendanlong.com>2017-10-29 17:10:14 +0300
commit15d6d32f54cd8efb66769012abea524cc0a7bc66 (patch)
tree6f9d31e0a945cabe00dab57aa3b908fc496d58c7
parent8489813e3dfbb81053fd0a9ad5c1d2ed9e2bae5b (diff)
Move "since" to FeedServer instead of calculating it in the Feedbin plugin
-rw-r--r--plugins/backend/bazqux/bazquxInterface.vala2
-rw-r--r--plugins/backend/demo/demoInterface.vala3
-rw-r--r--plugins/backend/feedbin/feedbinInterface.vala13
-rw-r--r--plugins/backend/feedhq/feedhqInterface.vala2
-rw-r--r--plugins/backend/feedly/feedlyInterface.vala2
-rw-r--r--plugins/backend/fresh/freshInterface.vala2
-rw-r--r--plugins/backend/inoreader/InoReaderInterface.vala2
-rw-r--r--plugins/backend/local/localInterface.vala2
-rw-r--r--plugins/backend/oldreader/oldreaderInterface.vala2
-rw-r--r--plugins/backend/owncloud/OwncloudNewsInterface.vala2
-rw-r--r--plugins/backend/ttrss/ttrssInterface.vala2
-rw-r--r--src/Backend/FeedServer.vala34
-rw-r--r--src/Backend/FeedServerInterface.vala2
13 files changed, 36 insertions, 34 deletions
diff --git a/plugins/backend/bazqux/bazquxInterface.vala b/plugins/backend/bazqux/bazquxInterface.vala
index e1ac551f..2f5ab24d 100644
--- a/plugins/backend/bazqux/bazquxInterface.vala
+++ b/plugins/backend/bazqux/bazquxInterface.vala
@@ -387,7 +387,7 @@ public class FeedReader.bazquxInterface : Peas.ExtensionBase, FeedServerInterfac
return m_api.getTotalUnread();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
if(whatToGet == ArticleStatus.READ)
{
diff --git a/plugins/backend/demo/demoInterface.vala b/plugins/backend/demo/demoInterface.vala
index 8de7900f..115af584 100644
--- a/plugins/backend/demo/demoInterface.vala
+++ b/plugins/backend/demo/demoInterface.vala
@@ -564,6 +564,7 @@ public class FeedReader.demoInterface : Peas.ExtensionBase, FeedServerInterface
//
// "count": the number of articles to get
// "whatToGet": the kind of articles to get (all/unread/marked/etc.)
+ // "since": how far back to sync articles (null = no limit)
// "feedID": get only articles of a secific feed or tag
// "isTagID": false if "feedID" is a feed-ID, true if "feedID" is a tag-ID
//
@@ -574,7 +575,7 @@ public class FeedReader.demoInterface : Peas.ExtensionBase, FeedServerInterface
// But if the API suggests a different approach you can everything on your
// own (see ttrss-backend).
//--------------------------------------------------------------------------------------
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
}
diff --git a/plugins/backend/feedbin/feedbinInterface.vala b/plugins/backend/feedbin/feedbinInterface.vala
index 1e85ddf7..e7c1290a 100644
--- a/plugins/backend/feedbin/feedbinInterface.vala
+++ b/plugins/backend/feedbin/feedbinInterface.vala
@@ -628,21 +628,10 @@ public class FeedReader.FeedbinInterface : Peas.ExtensionBase, FeedServerInterfa
}
}
- public void getArticles(int count, ArticleStatus what_to_get, string? feed_id_str, bool is_tag_id, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus what_to_get, DateTime? since, string? feed_id_str, bool is_tag_id, GLib.Cancellable? cancellable = null)
{
try
{
- var settings_state = new GLib.Settings("org.gnome.feedreader.saved-state");
- DateTime? since = ((DropArticles)Settings.general().get_enum("drop-articles-after")).to_start_date();
- if(!DataBase.readOnly().isTableEmpty("articles"))
- {
- var last_sync = new DateTime.from_unix_utc(settings_state.get_int("last-sync"));
- if(since == null || last_sync.to_unix() > since.to_unix())
- {
- since = last_sync;
- }
- }
-
int64? feed_id = null;
if(!is_tag_id && feed_id_str != null)
feed_id = int64.parse(feed_id_str);
diff --git a/plugins/backend/feedhq/feedhqInterface.vala b/plugins/backend/feedhq/feedhqInterface.vala
index 1c65f990..6e5a6f49 100644
--- a/plugins/backend/feedhq/feedhqInterface.vala
+++ b/plugins/backend/feedhq/feedhqInterface.vala
@@ -390,7 +390,7 @@ public class FeedReader.FeedHQInterface : Peas.ExtensionBase, FeedServerInterfac
return m_api.getTotalUnread();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
if(whatToGet == ArticleStatus.READ)
{
diff --git a/plugins/backend/feedly/feedlyInterface.vala b/plugins/backend/feedly/feedlyInterface.vala
index 0eba72b1..48c361c3 100644
--- a/plugins/backend/feedly/feedlyInterface.vala
+++ b/plugins/backend/feedly/feedlyInterface.vala
@@ -364,7 +364,7 @@ public class FeedReader.feedlyInterface : Peas.ExtensionBase, FeedServerInterfac
return m_api.getTotalUnread();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
string continuation = null;
string feedly_tagID = "";
diff --git a/plugins/backend/fresh/freshInterface.vala b/plugins/backend/fresh/freshInterface.vala
index 6caf51f9..934a858b 100644
--- a/plugins/backend/fresh/freshInterface.vala
+++ b/plugins/backend/fresh/freshInterface.vala
@@ -452,7 +452,7 @@ public class FeedReader.freshInterface : Peas.ExtensionBase, FeedServerInterface
return m_api.getUnreadCounts();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
if(whatToGet == ArticleStatus.READ)
{
diff --git a/plugins/backend/inoreader/InoReaderInterface.vala b/plugins/backend/inoreader/InoReaderInterface.vala
index 3a6debd4..16df9b66 100644
--- a/plugins/backend/inoreader/InoReaderInterface.vala
+++ b/plugins/backend/inoreader/InoReaderInterface.vala
@@ -378,7 +378,7 @@ public class FeedReader.InoReaderInterface : Peas.ExtensionBase, FeedServerInter
return m_api.getTotalUnread();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
if(whatToGet == ArticleStatus.READ)
{
diff --git a/plugins/backend/local/localInterface.vala b/plugins/backend/local/localInterface.vala
index 6f22d8d7..2ef14fe6 100644
--- a/plugins/backend/local/localInterface.vala
+++ b/plugins/backend/local/localInterface.vala
@@ -531,7 +531,7 @@ public class FeedReader.localInterface : Peas.ExtensionBase, FeedServerInterface
return 0;
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
var f = DataBase.readOnly().read_feeds();
var articleArray = new Gee.LinkedList<Article>();
diff --git a/plugins/backend/oldreader/oldreaderInterface.vala b/plugins/backend/oldreader/oldreaderInterface.vala
index 7fbfb425..05ac2e21 100644
--- a/plugins/backend/oldreader/oldreaderInterface.vala
+++ b/plugins/backend/oldreader/oldreaderInterface.vala
@@ -405,7 +405,7 @@ public class FeedReader.OldReaderInterface : Peas.ExtensionBase, FeedServerInter
return m_api.getTotalUnread();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
if(whatToGet == ArticleStatus.READ)
{
diff --git a/plugins/backend/owncloud/OwncloudNewsInterface.vala b/plugins/backend/owncloud/OwncloudNewsInterface.vala
index 9a1f3a22..a2a87512 100644
--- a/plugins/backend/owncloud/OwncloudNewsInterface.vala
+++ b/plugins/backend/owncloud/OwncloudNewsInterface.vala
@@ -432,7 +432,7 @@ public class FeedReader.OwncloudNewsInterface : Peas.ExtensionBase, FeedServerIn
return (int)DataBase.readOnly().get_unread_total();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
var type = OwncloudNewsAPI.OwnCloudType.ALL;
bool read = true;
diff --git a/plugins/backend/ttrss/ttrssInterface.vala b/plugins/backend/ttrss/ttrssInterface.vala
index 915d1057..74473fb9 100644
--- a/plugins/backend/ttrss/ttrssInterface.vala
+++ b/plugins/backend/ttrss/ttrssInterface.vala
@@ -453,7 +453,7 @@ public class FeedReader.ttrssInterface : Peas.ExtensionBase, FeedServerInterface
return m_api.getUnreadCount();
}
- public void getArticles(int count, ArticleStatus whatToGet, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet, DateTime? since, string? feedID, bool isTagID, GLib.Cancellable? cancellable = null)
{
var settings_general = new GLib.Settings("org.gnome.feedreader");
diff --git a/src/Backend/FeedServer.vala b/src/Backend/FeedServer.vala
index 928978c0..9032e72d 100644
--- a/src/Backend/FeedServer.vala
+++ b/src/Backend/FeedServer.vala
@@ -196,7 +196,16 @@ public class FeedReader.FeedServer : GLib.Object {
if(cancellable != null && cancellable.is_cancelled())
return;
-
+ var drop_articles = (DropArticles)Settings.general().get_enum("drop-articles-after");
+ DateTime? since = drop_articles.to_start_date();
+ if(!DataBase.readOnly().isTableEmpty("articles"))
+ {
+ var last_sync = new DateTime.from_unix_utc(Settings.state().get_int("last-sync"));
+ if(since == null || last_sync.to_unix() > since.to_unix())
+ {
+ since = last_sync;
+ }
+ }
int unread = getUnreadCount();
int max = ArticleSyncCount();
@@ -208,12 +217,12 @@ public class FeedReader.FeedServer : GLib.Object {
if(unread > max && useMaxArticles())
{
- getArticles(20, ArticleStatus.MARKED, null, false, cancellable);
- getArticles(unread, ArticleStatus.UNREAD, null, false, cancellable);
+ getArticles(20, ArticleStatus.MARKED, since, null, false, cancellable);
+ getArticles(unread, ArticleStatus.UNREAD, since, null, false, cancellable);
}
else
{
- getArticles(max, ArticleStatus.ALL, null, false, cancellable);
+ getArticles(max, ArticleStatus.ALL, since, null, false, cancellable);
}
if(cancellable != null && cancellable.is_cancelled())
@@ -230,7 +239,7 @@ public class FeedReader.FeedServer : GLib.Object {
Notification.send(newArticles);
}
- var drop_weeks = ((DropArticles)Settings.general().get_enum("drop-articles-after")).to_weeks();
+ var drop_weeks = drop_articles.to_weeks();
if(drop_weeks != null)
DataBase.writeAccess().dropOldArtilces(-(int)drop_weeks);
@@ -277,9 +286,12 @@ public class FeedReader.FeedServer : GLib.Object {
if(cancellable != null && cancellable.is_cancelled())
return;
+ var drop_articles = (DropArticles)Settings.general().get_enum("drop-articles-after");
+ DateTime? since = drop_articles.to_start_date();
+
// get marked articles
syncProgress(_("Getting starred articles"));
- getArticles(Settings.general().get_int("max-articles"), ArticleStatus.MARKED, null, false, cancellable);
+ getArticles(Settings.general().get_int("max-articles"), ArticleStatus.MARKED, since, null, false, cancellable);
if(cancellable != null && cancellable.is_cancelled())
return;
@@ -288,7 +300,7 @@ public class FeedReader.FeedServer : GLib.Object {
syncProgress(_("Getting tagged articles"));
foreach(var tag_item in DataBase.readOnly().read_tags())
{
- getArticles((Settings.general().get_int("max-articles")/8), ArticleStatus.ALL, tag_item.getTagID(), true, cancellable);
+ getArticles((Settings.general().get_int("max-articles")/8), ArticleStatus.ALL, since, tag_item.getTagID(), true, cancellable);
if(cancellable != null && cancellable.is_cancelled())
return;
}
@@ -296,7 +308,7 @@ public class FeedReader.FeedServer : GLib.Object {
if(useMaxArticles())
{
//get max-articls amunt like normal sync
- getArticles(Settings.general().get_int("max-articles"), ArticleStatus.ALL, null, false, cancellable);
+ getArticles(Settings.general().get_int("max-articles"), ArticleStatus.ALL, since, null, false, cancellable);
}
if(cancellable != null && cancellable.is_cancelled())
@@ -304,7 +316,7 @@ public class FeedReader.FeedServer : GLib.Object {
// get unread articles
syncProgress(_("Getting unread articles"));
- getArticles(getUnreadCount(), ArticleStatus.UNREAD, null, false, cancellable);
+ getArticles(getUnreadCount(), ArticleStatus.UNREAD, since, null, false, cancellable);
if(cancellable != null && cancellable.is_cancelled())
return;
@@ -948,12 +960,12 @@ public class FeedReader.FeedServer : GLib.Object {
return m_plugin.getUnreadCount();
}
- public void getArticles(int count, ArticleStatus whatToGet = ArticleStatus.ALL, string? feedID = null, bool isTagID = false, GLib.Cancellable? cancellable = null)
+ public void getArticles(int count, ArticleStatus whatToGet = ArticleStatus.ALL, DateTime? since = null, string? feedID = null, bool isTagID = false, GLib.Cancellable? cancellable = null)
{
if(!m_pluginLoaded)
return;
- m_plugin.getArticles(count, whatToGet, feedID, isTagID);
+ m_plugin.getArticles(count, whatToGet, since, feedID, isTagID);
}
private void syncProgress(string text)
diff --git a/src/Backend/FeedServerInterface.vala b/src/Backend/FeedServerInterface.vala
index c8a8baf3..1cbd11ba 100644
--- a/src/Backend/FeedServerInterface.vala
+++ b/src/Backend/FeedServerInterface.vala
@@ -108,7 +108,7 @@ public interface FeedReader.FeedServerInterface : GLib.Object {
public abstract int getUnreadCount();
- public abstract void getArticles(int count, ArticleStatus whatToGet = ArticleStatus.ALL, string? feedID = null, bool isTagID = false, GLib.Cancellable? cancellable = null);
+ public abstract void getArticles(int count, ArticleStatus whatToGet = ArticleStatus.ALL, DateTime? since = null, string? feedID = null, bool isTagID = false, GLib.Cancellable? cancellable = null);
// UI stuff
public signal void tryLogin();