summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 10:10:17 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 11:13:35 +0200
commit8ef049e020bd40c14e6a104576f116b391c6a18b (patch)
tree6077549e13ce0f946cde790db25965b48e6f666c
parentd3c9c1d52480ac251d06419bdf144b02c7bacd60 (diff)
downloadempathy-8ef049e020bd40c14e6a104576f116b391c6a18b.tar.gz
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 735e2db9d..b550245dc 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -1921,7 +1921,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;
@@ -1953,13 +1953,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);
}