]> git.0d.be Git - empathy.git/commitdiff
add empathy_avatar_save_to_file (Guillaume Desmottes)
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 8 Jul 2008 17:32:41 +0000 (17:32 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 8 Jul 2008 17:32:41 +0000 (17:32 +0000)
svn path=/trunk/; revision=1209

libempathy/empathy-contact.c
libempathy/empathy-contact.h

index 46aee93eaa230235c01eda441299956182e642c5..489e02c2e0bc2a99d9a817dd4a140893d558ce6e 100644 (file)
@@ -829,7 +829,7 @@ empathy_contact_load_avatar_data (EmpathyContact *contact,
        /* Save to cache if not yet in it */
        filename = contact_get_avatar_filename (contact, token);
        if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS)) {
-               if (!g_file_set_contents (filename, data, len, &error)) {
+               if (!empathy_avatar_save_to_file (avatar, filename, &error)) {
                        DEBUG ("Failed to save avatar in cache: %s",
                                error ? error->message : "No error given");
                        g_clear_error (&error);
@@ -931,3 +931,10 @@ empathy_avatar_ref (EmpathyAvatar *avatar)
        return avatar;
 }
 
+gboolean
+empathy_avatar_save_to_file (EmpathyAvatar *self,
+                             const gchar *filename,
+                             GError **error)
+{
+  return g_file_set_contents (filename, self->data, self->len, error);
+}
index fe27a04c8ec979c334e05152dd0465d7eb3b7858..d556fd24e0981bd39585776ba5697a7cbc6bd918 100644 (file)
@@ -134,6 +134,9 @@ EmpathyAvatar *     empathy_avatar_new                 (guchar              *dat
 EmpathyAvatar *     empathy_avatar_ref                 (EmpathyAvatar       *avatar);
 void                empathy_avatar_unref               (EmpathyAvatar       *avatar);
 
+gboolean empathy_avatar_save_to_file (EmpathyAvatar *self,
+    const gchar *filename, GError **error);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_CONTACT_H__ */