Browse Source

Starting the read/unread status. Layout is BAD

master
Julio Biason 15 years ago
parent
commit
df518ba0ea
  1. 19
      mitterlib/ui/ui_pygtk.py

19
mitterlib/ui/ui_pygtk.py

@ -271,9 +271,9 @@ class Interface(object):
self._grid.set_resize_mode(gtk.RESIZE_IMMEDIATE)
self._grid.connect('cursor-changed', self._message_selected)
#self._grid.connect('row-activated', self.open_post)
self._grid.connect('button-press-event', self._click_message)
self._grid.connect('popup-menu', self._message_popup) # Menu button
self._grid.connect('cursor-changed', self._mark_message_read)
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
@ -570,6 +570,9 @@ class Interface(object):
# r'<span foreground="#FF6633">\1</span>',
# message)
if not data.read:
message = "<b>" + message + "</b>"
if data.reposted_by:
markup = '<b>%s</b> <small>(%s -- <i>reposted by %s</i>)' \
'</small>:\n%s\n<small>%s</small>' % \
@ -948,6 +951,19 @@ class Interface(object):
webbrowser.open_new_tab(user_data)
return
def _mark_message_read(self, widget, user_data=None):
"""Mark a message as read when it's selected."""
(path, _) = self._grid.get_cursor()
if not path:
return True
iter = self._grid.get_model().get_iter(path)
message = self._grid.get_model().get_value(iter, 0)
message.read = True
return True
# ------------------------------------------------------------
# Network related functions
# ------------------------------------------------------------
@ -964,6 +980,7 @@ class Interface(object):
store = self._grid.get_model()
for message in results:
_log.debug('Data: %s', str(message))
message.read = False
store.prepend([message])
store.sort_column_changed()
if len(results) > 0:

Loading…
Cancel
Save