[gnome-news/wip/gbsneto/improvements: 3/6] views: show read items less proeminent than unread ones
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-news/wip/gbsneto/improvements: 3/6] views: show read items less proeminent than unread ones
- Date: Sat, 5 Mar 2016 23:24:40 +0000 (UTC)
commit e2340d9bb6d0544d1788a7823e40b53ff8f6a85f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Mar 5 19:22:43 2016 -0300
views: show read items less proeminent than unread ones
gnomenews/post.py | 1 +
gnomenews/view.py | 19 +++++++++----------
gnomenews/window.py | 5 +++--
3 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/gnomenews/post.py b/gnomenews/post.py
index 820403a..88b95bf 100644
--- a/gnomenews/post.py
+++ b/gnomenews/post.py
@@ -46,6 +46,7 @@ class Post(GObject.GObject):
self.title = cursor['title']
self.content = cursor['content']
self.url = cursor['url']
+ self.is_read = cursor['is_read']
self.author = self.sanitize_author(cursor['fullname'])
self.author_email = cursor['author_email']
diff --git a/gnomenews/view.py b/gnomenews/view.py
index cfface6..56de740 100644
--- a/gnomenews/view.py
+++ b/gnomenews/view.py
@@ -79,7 +79,11 @@ class GenericFeedsView(Gtk.Stack):
def _insert_post(self, source, post):
image = Gtk.Image.new_from_file(post.thumbnail)
image.get_style_context().add_class('feed-box')
- image.show_all()
+ image.show()
+
+ if post.is_read:
+ image.set_opacity(0.5)
+ image.set_tooltip_text(_('This article was already read'))
# Store the post object to refer to it later on
image.post = post.cursor
@@ -90,6 +94,10 @@ class GenericFeedsView(Gtk.Stack):
def _post_activated(self, box, child, user_data=None):
cursor = child.get_children()[0].post
post = Post(cursor)
+
+ child.set_opacity(0.5)
+ child.set_tooltip_text(_('This article was already read'))
+
self.emit('open-article', post)
@log
@@ -108,11 +116,6 @@ class GenericFeedsView(Gtk.Stack):
class FeedView(Gtk.Stack):
-
- __gsignals__ = {
- 'post-read': (GObject.SignalFlags.RUN_LAST, None, (str,)),
- }
-
def __init__(self, tracker, post):
Gtk.Stack.__init__(self,
transition_type=Gtk.StackTransitionType.CROSSFADE)
@@ -164,10 +167,6 @@ class FeedView(Gtk.Stack):
return True
return False
- def mark_post_as_read(self):
- self.emit('post-read', self.url)
- return False
-
class NewView(GenericFeedsView):
def __init__(self, tracker):
diff --git a/gnomenews/window.py b/gnomenews/window.py
index bd7cf05..306ff4d 100644
--- a/gnomenews/window.py
+++ b/gnomenews/window.py
@@ -152,7 +152,9 @@ class Window(Gtk.ApplicationWindow):
self._stack.previous_view = self._stack.get_visible_child()
self._stack.add_named(self.feed_view, 'feedview')
self._stack.set_visible_child(self.feed_view)
- self.tracker.post_read_signal = self.feed_view.connect('post-read', self.tracker.mark_post_as_read)
+
+ # Mark the post as read
+ self.tracker.mark_post_as_read(post.url)
@log
def on_back_button_clicked(self, widget):
@@ -160,7 +162,6 @@ class Window(Gtk.ApplicationWindow):
self._stack.previous_view = None
self._stack.remove(self.feed_view)
self.toolbar.set_state(ToolbarState.MAIN)
- self.feed_view.disconnect(self.tracker.post_read_signal)
self.feed_view = None
@log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]