diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-23 20:11:30 +0800 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-24 17:32:37 +0800 |
commit | 77646a2826689c6f171e5a80eb1cf4702b458494 (patch) | |
tree | 3eb762bb698ee7d32ef4fd59e56d8249e6a56677 /libempathy-gtk | |
parent | 597f34ccdbe2000aad148147d9ecafb3e17c9e0a (diff) | |
download | gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar.gz gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar.bz2 gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar.lz gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar.xz gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.tar.zst gsoc2013-empathy-77646a2826689c6f171e5a80eb1cf4702b458494.zip |
Use the avatar filename rather than token for change detection
The filename includes the token, so this allows us to remove the token field
from EmpathyAvatar.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-theme-boxes.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c index 24b7fc5b4..bf97f3f97 100644 --- a/libempathy-gtk/empathy-theme-boxes.c +++ b/libempathy-gtk/empathy-theme-boxes.c @@ -106,7 +106,7 @@ theme_boxes_pad_to_size (GdkPixbuf *pixbuf, typedef struct { GdkPixbuf *pixbuf; - gchar *token; + gchar *filename; } AvatarData; static void @@ -115,7 +115,7 @@ theme_boxes_avatar_cache_data_free (gpointer ptr) AvatarData *data = ptr; g_object_unref (data->pixbuf); - g_free (data->token); + g_free (data->filename); g_slice_free (AvatarData, data); } @@ -131,7 +131,7 @@ theme_boxes_get_avatar_pixbuf_with_cache (EmpathyContact *contact) avatar = empathy_contact_get_avatar (contact); data = g_object_get_data (G_OBJECT (contact), "chat-view-avatar-cache"); if (data) { - if (avatar && !tp_strdiff (avatar->token, data->token)) { + if (avatar && !tp_strdiff (avatar->filename, data->filename)) { /* We have the avatar in cache */ return data->pixbuf; } @@ -147,9 +147,11 @@ theme_boxes_get_avatar_pixbuf_with_cache (EmpathyContact *contact) return NULL; } - /* Insert new pixbuf in cache */ + /* Insert new pixbuf in cache. We store the filename as it's unique + * for each version of an avatar, so we can use it to perform change + * detection (as above). */ data = g_slice_new0 (AvatarData); - data->token = g_strdup (avatar->token); + data->filename = g_strdup (avatar->filename); data->pixbuf = pixbuf; g_object_set_data_full (G_OBJECT (contact), "chat-view-avatar-cache", |