From 3af11b07047b67675bb5082d3c0dd312cdfd9046 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Tue, 22 Dec 2009 11:08:56 -0200 Subject: [PATCH] queue pics on message receival, not on draw --- mitterlib/ui/ui_pygtk.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 119e330..46f3ff1 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -552,16 +552,6 @@ class Interface(object): data = store.get_value(position, 0) pic = data.avatar - if not pic in self._avatars: - # set the user avatar to the default image, so it won't get queued - # again. Once downloaded, the _post_download_pic will update the - # image and force a redraw. - self._avatars[pic] = self._images['avatar'] - self._threads.add_work(self._post_download_pic, - self._exception_download_pic, - self._download_pic, - pic) - cell.set_property('pixbuf', self._avatars[pic]) return @@ -1056,6 +1046,17 @@ class Interface(object): for message in results: _log.debug('Data: %s', str(message)) message.read = False + pic = message.avatar + if not pic in self._avatars: + # set the user avatar to the default image, so it won't get + # queued again. Once downloaded, the _post_download_pic will + # update the image and force a redraw. + self._avatars[pic] = self._images['avatar'] + self._threads.add_work(self._post_download_pic, + self._exception_download_pic, + self._download_pic, + pic) + store.prepend([message]) store.sort_column_changed() self._grid.queue_draw()