aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 16:10:17 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 17:15:49 +0800
commit0e2105c149b3e2d5fc8368cbab0daf546cd07cf3 (patch)
tree4d7ae3b1e48cb7efc01d81d33501ea5dbd82bc15
parentf6bdbd0bcafdc6dbad2fff389eedc9aa36a5fa1c (diff)
downloadgsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar.gz
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar.bz2
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar.lz
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar.xz
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.tar.zst
gsoc2013-empathy-0e2105c149b3e2d5fc8368cbab0daf546cd07cf3.zip
individual_store_get_individual_status_icon_with_icon_name: look in the cache before creating new pixbuf
-rw-r--r--libempathy-gtk/empathy-individual-store.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 242bad2be..1b4b4fd8a 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -1902,7 +1902,7 @@ individual_store_get_individual_status_icon_with_icon_name (
FolksIndividual *individual,
const gchar *status_icon_name)
{
- GdkPixbuf *pixbuf_status = NULL;
+ GdkPixbuf *pixbuf_status;
EmpathyIndividualStorePriv *priv;
const gchar *protocol_name = NULL;
gchar *icon_name = NULL;
@@ -1934,13 +1934,18 @@ individual_store_get_individual_status_icon_with_icon_name (
{
icon_name = g_strdup_printf ("%s", status_icon_name);
}
+
+ pixbuf_status = g_hash_table_lookup (priv->status_icons, icon_name);
+
if (pixbuf_status == NULL)
{
pixbuf_status =
empathy_pixbuf_contact_status_icon_with_icon_name (contact,
status_icon_name, show_protocols_here);
+
if (pixbuf_status != NULL)
{
+ /* pass the reference to the hash table */
g_hash_table_insert (priv->status_icons,
g_strdup (icon_name), pixbuf_status);
}