aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ui-utils.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:40 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-11-11 23:25:40 +0800
commit39c6d0512e3605aaafb1285d1f3627e3f92ec104 (patch)
tree3c3d15738ca14d1158cb030c89e2954288555996 /libempathy-gtk/empathy-ui-utils.c
parent41b9e32599950f4a1dfa4c0958c01519881e2063 (diff)
downloadgsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar.gz
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar.bz2
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar.lz
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar.xz
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.tar.zst
gsoc2013-empathy-39c6d0512e3605aaafb1285d1f3627e3f92ec104.zip
Don't automatically resize and png-ify avatars.
svn path=/trunk/; revision=1669
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index ae3675145..bf391ccc2 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -245,11 +245,14 @@ empathy_icon_name_for_contact (EmpathyContact *contact)
}
GdkPixbuf *
-empathy_pixbuf_from_data (gchar *data,
- gsize data_size)
+empathy_pixbuf_from_data (gchar *data,
+ gsize data_size,
+ gchar **mime_type)
{
GdkPixbufLoader *loader;
+ GdkPixbufFormat *format;
GdkPixbuf *pixbuf = NULL;
+ gchar **mime_types;
GError *error = NULL;
if (!data) {
@@ -260,23 +263,34 @@ empathy_pixbuf_from_data (gchar *data,
if (!gdk_pixbuf_loader_write (loader, data, data_size, &error)) {
DEBUG ("Failed to write to pixbuf loader: %s",
error ? error->message : "No error given");
- g_clear_error (&error);
- g_object_unref (loader);
- return NULL;
+ goto out;
}
if (!gdk_pixbuf_loader_close (loader, &error)) {
DEBUG ("Failed to close pixbuf loader: %s",
error ? error->message : "No error given");
- g_clear_error (&error);
- g_object_unref (loader);
- return NULL;
+ goto out;
}
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf) {
g_object_ref (pixbuf);
+
+ if (mime_type != NULL) {
+ format = gdk_pixbuf_loader_get_format (loader);
+ mime_types = gdk_pixbuf_format_get_mime_types (format);
+
+ *mime_type = g_strdup (*mime_types);
+ if (*(mime_types + 1) != NULL) {
+ DEBUG ("Loader supports more than one mime "
+ "type! Picking the first one, %s",
+ *mime_type);
+ }
+ g_strfreev (mime_types);
+ }
}
+out:
+ g_clear_error (&error);
g_object_unref (loader);
return pixbuf;