[gnome-news/wip/gbsneto/improvements] feeds-view: update items when something changes



commit 7247c69e0bfd4968fa0f0cd63d8e23a699ee62c1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Mar 5 20:04:59 2016 -0300

    feeds-view: update items when something changes
    
    If we read an item in the News view and directly jump
    into Feeds view, the item is not marked as read.
    
    Fix that by updating items when something changes on
    Tracker side.

 gnomenews/view.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gnomenews/view.py b/gnomenews/view.py
index 9107be6..62196b4 100644
--- a/gnomenews/view.py
+++ b/gnomenews/view.py
@@ -196,9 +196,20 @@ class FeedsView(GenericFeedsView):
         delete_channel_action = app.lookup_action('delete_channel')
         delete_channel_action.connect('activate', self.delete_channel)
 
+        self.tracker.connect('items-updated', self.update_items)
         self.tracker.connect('feeds-updated', self.update)
 
     @log
+    def update_items(self, _=None):
+        for flowbox in self.feed_stack.get_children():
+            url = self.feed_stack.child_get_property(flowbox, 'name')
+
+            [flowbox.remove(old_feed) for old_feed in flowbox.get_children()]
+
+            posts = self.tracker.get_posts_for_channel(url)
+            [self._add_a_new_preview(post, flowbox) for post in posts]
+
+    @log
     def update(self, _=None):
         new_feeds = self.tracker.get_channels()
         new_feed_urls = [new_feed['url'] for new_feed in new_feeds]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]