- OssoABookContact *abook_contact;
-
- photo = e_contact_get (E_CONTACT (contact->data), E_CONTACT_PHOTO);
- if (photo) {
- if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
- GdkPixbufLoader *loader;
-
- loader = gdk_pixbuf_loader_new ();
- if (gdk_pixbuf_loader_write (loader, (guchar *) photo->data.inlined.data, photo->data.inlined.length, NULL))
- avatar = gdk_pixbuf_loader_get_pixbuf (loader);
-
- } else {
- gchar *avatar_filename = NULL;
-
- avatar_filename = g_filename_from_uri (photo->data.uri, NULL, NULL);
- if (avatar_filename) {
- avatar = gdk_pixbuf_new_from_file (avatar_filename, &error);
- g_free (avatar_filename);
- }
- }
-
- if (avatar) {
- gint height = gdk_pixbuf_get_height (avatar);
- if (height != 48) {
- gint new_height = 48;
- gint new_width = new_height * gdk_pixbuf_get_width (avatar) / height;
- avatar = gdk_pixbuf_scale_simple (avatar, new_width, new_height, GDK_INTERP_BILINEAR);
- }
- }
- e_contact_photo_free (photo);
- photo = NULL;
- } else {
+
+ avatar = osso_abook_avatar_get_image_rounded (OSSO_ABOOK_AVATAR (contact->data), 48, 48, TRUE, 4, NULL);
+ if (!avatar) {