]> git.0d.be Git - empathy.git/commitdiff
Use the avatar filename rather than token for change detection
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 23 Aug 2010 12:11:30 +0000 (13:11 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 24 Aug 2010 09:32:37 +0000 (10:32 +0100)
The filename includes the token, so this allows us to remove the token field
from EmpathyAvatar.

libempathy-gtk/empathy-theme-boxes.c

index 24b7fc5b4a47c6babd4f58c8c59cff42a30d2d24..bf97f3f97dcdebf5fcc6b2f74fd4d7b7e9254ec2 100644 (file)
@@ -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",