|
|
|
@ -393,14 +393,29 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject):
|
|
|
|
|
"""Update the grid with new messages.""" |
|
|
|
|
self._grid.freeze_notify() |
|
|
|
|
store = self._grid.get_model() |
|
|
|
|
|
|
|
|
|
# disconnect the store, so we are free to add rows without hogging the |
|
|
|
|
# system. Also, save the current selection and grid position so it can |
|
|
|
|
# be restore (selecting is lost when the model is connected and the |
|
|
|
|
# view moves with the new elements.) |
|
|
|
|
(model, iter) = self._grid.get_selection().get_selected() |
|
|
|
|
self._grid.set_model(None) |
|
|
|
|
|
|
|
|
|
for message in messages: |
|
|
|
|
message.read = False |
|
|
|
|
store.prepend([message]) |
|
|
|
|
store.sort_column_changed() |
|
|
|
|
|
|
|
|
|
# reconnect the store and re-select the previously selected line |
|
|
|
|
self._grid.set_model(store) |
|
|
|
|
if iter: |
|
|
|
|
self._grid.get_selection().select_iter(iter) |
|
|
|
|
|
|
|
|
|
self._grid.thaw_notify() |
|
|
|
|
self._grid.queue_draw() |
|
|
|
|
|
|
|
|
|
self.count += len(messages) |
|
|
|
|
new_messages = len(messages) |
|
|
|
|
_log.debug('%d new messages', new_messages) |
|
|
|
|
self.count += new_messages |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
def clear_posts(self): |
|
|
|
|