clients_icons.[Mic92].Improve performance enormous
This commit is contained in:
@@ -167,6 +167,7 @@ class ClientsIconsPlugin(GajimPlugin):
|
|||||||
icon_path = os.path.join(self.local_file_path('icons'), 'unknown.png')
|
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,
|
self.default_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path,
|
||||||
16, 16)
|
16, 16)
|
||||||
|
self.icon_cache = {}
|
||||||
|
|
||||||
@log_calls('ClientsIconsPlugin')
|
@log_calls('ClientsIconsPlugin')
|
||||||
def connect_with_roster_draw_contact(self, roster, jid, account, contact):
|
def connect_with_roster_draw_contact(self, roster, jid, account, contact):
|
||||||
@@ -379,8 +380,12 @@ class ClientsIconsPlugin(GajimPlugin):
|
|||||||
else:
|
else:
|
||||||
icon_path = os.path.join(self.local_file_path('icons'),
|
icon_path = os.path.join(self.local_file_path('icons'),
|
||||||
client_icon)
|
client_icon)
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 16, 16)
|
if icon_path in self.icon_cache:
|
||||||
model[iter_][pos] = pixbuf
|
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):
|
def tree_cell_data_func(self, column, renderer, model, iter_, control):
|
||||||
if not model.iter_parent(iter_):
|
if not model.iter_parent(iter_):
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ description: Shows the client icons in the roster
|
|||||||
Depends: Gajim > r12506
|
Depends: Gajim > r12506
|
||||||
authors = Denis Fomin <fominde@gmail.com>
|
authors = Denis Fomin <fominde@gmail.com>
|
||||||
Artem Klyop <art.klyop@gmail.com>
|
Artem Klyop <art.klyop@gmail.com>
|
||||||
homepage = http://trac-plugins.gajim.org/wiki/ClientsIcons
|
homepage = http://trac-plugins.gajim.org/wiki/ClientsIconsPlugin
|
||||||
|
|||||||
Reference in New Issue
Block a user