aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:32:41 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:32:41 +0800
commitdd1dfc2d27d2480e0b2933117e57895ca2329f98 (patch)
treeba78f9435bee52001efc819a8a55a62c38d465aa
parent700739c21b17d38188e84209cb78c759fa5ad9be (diff)
downloadgsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar.gz
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar.bz2
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar.lz
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar.xz
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.tar.zst
gsoc2013-empathy-dd1dfc2d27d2480e0b2933117e57895ca2329f98.zip
add empathy_avatar_save_to_file (Guillaume Desmottes)
svn path=/trunk/; revision=1209
-rw-r--r--libempathy/empathy-contact.c9
-rw-r--r--libempathy/empathy-contact.h3
2 files changed, 11 insertions, 1 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 46aee93ea..489e02c2e 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -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);
+}
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index fe27a04c8..d556fd24e 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -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__ */