| 69 |
69 |
| 70 def update_feed_item(item, property): |
70 def update_feed_item(item, property): |
| 71 if property.name == 'unread': |
71 if property.name == 'unread': |
| 72 if feeds.active != item.parent: |
72 if feeds.active != item.parent: |
| 73 return |
73 return |
| |
74 flag = 0 |
| |
75 if item == items.active: |
| |
76 flag = gnt.TEXT_FLAG_UNDERLINE |
| 74 if item.unread: |
77 if item.unread: |
| 75 item.parent.unread = item.parent.unread + 1 |
78 item.parent.unread = item.parent.unread + 1 |
| 76 items.set_row_flags(item, gnt.TEXT_FLAG_BOLD) |
79 items.set_row_flags(item, flag | gnt.TEXT_FLAG_BOLD) |
| 77 else: |
80 else: |
| 78 item.parent.unread = item.parent.unread - 1 |
81 item.parent.unread = item.parent.unread - 1 |
| 79 items.set_row_flags(item, gnt.TEXT_FLAG_NORMAL) |
82 items.set_row_flags(item, flag | gnt.TEXT_FLAG_NORMAL) |
| 80 item.parent.notify('unread') |
83 item.parent.notify('unread') |
| 81 |
84 |
| 82 def add_feed_item(item): |
85 def add_feed_item(item): |
| 83 currentfeed = feeds.active |
86 currentfeed = feeds.active |
| 84 if item.parent != currentfeed: |
87 if item.parent != currentfeed: |
| 156 details.append_text_with_flags(str(item.title) + "\n", gnt.TEXT_FLAG_BOLD) |
159 details.append_text_with_flags(str(item.title) + "\n", gnt.TEXT_FLAG_BOLD) |
| 157 details.append_text_with_flags(str(item.summary), gnt.TEXT_FLAG_NORMAL) |
160 details.append_text_with_flags(str(item.summary), gnt.TEXT_FLAG_NORMAL) |
| 158 details.scroll(0) |
161 details.scroll(0) |
| 159 if item.unread: |
162 if item.unread: |
| 160 item.set_property('unread', False) |
163 item.set_property('unread', False) |
| |
164 if old and old.unread: |
| |
165 old.set_property('unread', True) |
| 161 |
166 |
| 162 # |
167 # |
| 163 # Look for action keys in the feed-item list. |
168 # Look for action keys in the feed-item list. |
| 164 def item_key_pressed(tree, text): |
169 def item_key_pressed(tree, text): |
| 165 current = tree.get_selection_data() |
170 current = tree.get_selection_data() |
| 168 for item in all: |
173 for item in all: |
| 169 item.unread = False |
174 item.unread = False |
| 170 elif text == 'm': # Mark the current item 'read' |
175 elif text == 'm': # Mark the current item 'read' |
| 171 if current.unread: |
176 if current.unread: |
| 172 current.set_property('unread', False) |
177 current.set_property('unread', False) |
| |
178 tree.perform_action_key('j') |
| 173 elif text == 'U': # Mark the current item 'unread' |
179 elif text == 'U': # Mark the current item 'unread' |
| 174 if not current.unread: |
180 if not current.unread: |
| 175 current.set_property('unread', True) |
181 current.set_property('unread', True) |
| |
182 elif text == 'd': |
| |
183 current.remove() |
| |
184 tree.perform_action_key('j') |
| 176 else: |
185 else: |
| 177 return False |
186 return False |
| 178 return True |
187 return True |
| 179 |
188 |
| 180 items = RssTree() |
189 items = RssTree() |