|
|
|
@ -283,17 +283,6 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject):
|
|
|
|
|
self.count -= 1 |
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
def update(self, messages): |
|
|
|
|
"""Update the grid with new messages.""" |
|
|
|
|
self._grid.freeze() |
|
|
|
|
store = self._grid.get_model() |
|
|
|
|
for message in messages: |
|
|
|
|
message.read = False |
|
|
|
|
store.prepend([message]) |
|
|
|
|
store.sort_column_changed() |
|
|
|
|
self._grid.thaw() |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def _order_datetime(self, model, iter1, iter2, user_data=None): |
|
|
|
|
"""Used by the ListStore to sort the columns (in our case, "column") |
|
|
|
|
by date.""" |
|
|
|
@ -311,29 +300,6 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject):
|
|
|
|
|
return 1 |
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
def clear_posts(self, widget, user_data=None): |
|
|
|
|
"""Clear the list of posts from the grid.""" |
|
|
|
|
self._grid.get_model().clear() |
|
|
|
|
self.count = 0; |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def mark_all_read(self, widget, user_data=None): |
|
|
|
|
"""Mark all messages as read.""" |
|
|
|
|
model = self._grid.get_model() |
|
|
|
|
if len(model) == 0: |
|
|
|
|
# no messages, so we don't worry (if I recall correctly, |
|
|
|
|
# get_iter_first will fail if the model is empty) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
iter = model.get_iter_first() |
|
|
|
|
while iter: |
|
|
|
|
message = model.get_value(iter, 0) |
|
|
|
|
message.read = True |
|
|
|
|
iter = model.iter_next(iter) |
|
|
|
|
|
|
|
|
|
self.count = 0 |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def _open_url(self, widget, user_data=None): |
|
|
|
|
"""Opens an URL (used mostly from popup menu items.)""" |
|
|
|
|
webbrowser.open_new_tab(user_data) |
|
|
|
@ -362,3 +328,38 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject):
|
|
|
|
|
model.row_changed(path, iter) |
|
|
|
|
iter = model.iter_next(iter) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def update(self, messages): |
|
|
|
|
"""Update the grid with new messages.""" |
|
|
|
|
self._grid.freeze() |
|
|
|
|
store = self._grid.get_model() |
|
|
|
|
for message in messages: |
|
|
|
|
message.read = False |
|
|
|
|
store.prepend([message]) |
|
|
|
|
store.sort_column_changed() |
|
|
|
|
self._grid.thaw() |
|
|
|
|
self._grid.queue_draw() |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def clear_posts(self, widget, user_data=None): |
|
|
|
|
"""Clear the list of posts from the grid.""" |
|
|
|
|
self._grid.get_model().clear() |
|
|
|
|
self.count = 0; |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def mark_all_read(self, widget, user_data=None): |
|
|
|
|
"""Mark all messages as read.""" |
|
|
|
|
model = self._grid.get_model() |
|
|
|
|
if len(model) == 0: |
|
|
|
|
# no messages, so we don't worry (if I recall correctly, |
|
|
|
|
# get_iter_first will fail if the model is empty) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
iter = model.get_iter_first() |
|
|
|
|
while iter: |
|
|
|
|
message = model.get_value(iter, 0) |
|
|
|
|
message.read = True |
|
|
|
|
iter = model.iter_next(iter) |
|
|
|
|
|
|
|
|
|
self.count = 0 |
|
|
|
|
return |
|
|
|
|