Commit 40c4ab23 authored by Dicson's avatar Dicson

clients_icons.[Mic92].Improve performance enormous

parent 94b292a2
......@@ -167,6 +167,7 @@ class ClientsIconsPlugin(GajimPlugin):
icon_path = os.path.join(self.local_file_path('icons'), 'unknown.png')
self.default_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path,
16, 16)
self.icon_cache = {}
@log_calls('ClientsIconsPlugin')
def connect_with_roster_draw_contact(self, roster, jid, account, contact):
......@@ -379,8 +380,12 @@ class ClientsIconsPlugin(GajimPlugin):
else:
icon_path = os.path.join(self.local_file_path('icons'),
client_icon)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 16, 16)
model[iter_][pos] = pixbuf
if icon_path in self.icon_cache:
model[iter_][pos] = self.icon_cache[icon_path]
else:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 16, 16)
model[iter_][pos] = pixbuf
self.icon_cache[icon_path] = pixbuf
def tree_cell_data_func(self, column, renderer, model, iter_, control):
if not model.iter_parent(iter_):
......
......@@ -7,4 +7,4 @@ description: Shows the client icons in the roster
Depends: Gajim > r12506
authors = Denis Fomin <fominde@gmail.com>
Artem Klyop <art.klyop@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/ClientsIcons
homepage = http://trac-plugins.gajim.org/wiki/ClientsIconsPlugin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment