aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-avatar-chooser.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:36 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:36 +0800
commit41b9e32599950f4a1dfa4c0958c01519881e2063 (patch)
tree81fb97603daf960bae6ac6160874603c80fbf4bb /libempathy-gtk/empathy-avatar-chooser.c
parent7823981d59ab3752b8b1b0fef23f6a0cb11bc60d (diff)
downloadgsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar.gz
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar.bz2
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar.lz
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar.xz
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.tar.zst
gsoc2013-empathy-41b9e32599950f4a1dfa4c0958c01519881e2063.zip
Consolidate hardcoding avatars to PNG to one function.
(Incidentally, return "image/png" rather than "png" for the mime type, as the latter is not a mime type.) svn path=/trunk/; revision=1668
Diffstat (limited to 'libempathy-gtk/empathy-avatar-chooser.c')
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index b0142d72d..08dbfad18 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -45,6 +45,7 @@
typedef struct {
gchar *image_data;
gsize image_data_size;
+ gchar *mime_type;
} EmpathyAvatarChooserPriv;
static void avatar_chooser_finalize (GObject *object);
@@ -159,6 +160,7 @@ avatar_chooser_finalize (GObject *object)
priv = GET_PRIV (object);
g_free (priv->image_data);
+ g_free (priv->mime_type);
G_OBJECT_CLASS (empathy_avatar_chooser_parent_class)->finalize (object);
}
@@ -176,6 +178,8 @@ avatar_chooser_set_pixbuf (EmpathyAvatarChooser *chooser,
g_free (priv->image_data);
priv->image_data = NULL;
priv->image_data_size = 0;
+ g_free (priv->mime_type);
+ priv->mime_type = NULL;
if (pixbuf) {
pixbuf_view = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_VIEW);
@@ -189,6 +193,8 @@ avatar_chooser_set_pixbuf (EmpathyAvatarChooser *chooser,
DEBUG ("Failed to save pixbuf: %s",
error ? error->message : "No error given");
g_clear_error (&error);
+ } else {
+ priv->mime_type = "image/png";
}
image = gtk_image_new_from_pixbuf (pixbuf_view);
@@ -571,7 +577,7 @@ empathy_avatar_chooser_get_image_data (EmpathyAvatarChooser *chooser,
*data_size = priv->image_data_size;
}
if (mime_type) {
- *mime_type = "png";
+ *mime_type = priv->mime_type;
}
}