diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:37 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:37 +0800 |
commit | fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9 (patch) | |
tree | fa43f89134570a145e721945b72da07d27ac4f3f /libempathy-gtk/empathy-chat-view.c | |
parent | cf327059e269141a38a3aa38f0a37d3c6eb0fbbb (diff) | |
download | gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.gz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.bz2 gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.lz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.xz gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.tar.zst gsoc2013-empathy-fd6d3fc84dbd00c3c1015ac8f9b54935fc1c12e9.zip |
Make sure we don't expect contact id and handle to be directly ready. Add some _run_until_ready.
svn path=/trunk/; revision=755
Diffstat (limited to 'libempathy-gtk/empathy-chat-view.c')
-rw-r--r-- | libempathy-gtk/empathy-chat-view.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index f4ad7f316..af523180d 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -715,31 +715,19 @@ chat_view_avatar_cache_data_free (gpointer ptr) GdkPixbuf * empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact) { - static GHashTable *avatar_cache = NULL; AvatarData *data; EmpathyAvatar *avatar; GdkPixbuf *tmp_pixbuf; GdkPixbuf *pixbuf = NULL; - /* Init avatar cache */ - if (!avatar_cache) { - avatar_cache = g_hash_table_new_full (empathy_contact_hash, - empathy_contact_equal, - g_object_unref, - chat_view_avatar_cache_data_free); - } - /* Check if avatar is in cache and if it's up to date */ avatar = empathy_contact_get_avatar (contact); - data = g_hash_table_lookup (avatar_cache, contact); + data = g_object_get_data (G_OBJECT (contact), "chat-view-avatar-cache"); if (data) { if (avatar && !tp_strdiff (avatar->token, data->token)) { /* We have the avatar in cache */ return data->pixbuf; } - - /* The cache is outdate */ - g_hash_table_remove (avatar_cache, contact); } /* Avatar not in cache, create pixbuf */ @@ -757,9 +745,8 @@ empathy_chat_view_get_avatar_pixbuf_with_cache (EmpathyContact *contact) data->token = g_strdup (avatar->token); data->pixbuf = pixbuf; - g_hash_table_insert (avatar_cache, - g_object_ref (contact), - data); + g_object_set_data_full (G_OBJECT (contact), "chat-view-avatar-cache", + data, chat_view_avatar_cache_data_free); return data->pixbuf; } |