[evolution/wip/webkit2] Return empty image for contact-photo when no photo found
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Return empty image for contact-photo when no photo found
- Date: Tue, 29 Mar 2016 16:58:35 +0000 (UTC)
commit 1447745150ec93106f1c331eb191f14aff8472ef
Author: Milan Crha <mcrha redhat com>
Date: Tue Mar 29 18:57:53 2016 +0200
Return empty image for contact-photo when no photo found
That will not show "broken image" icon in the view.
mail/e-mail-request.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c
index a75710d..399bbef 100644
--- a/mail/e-mail-request.c
+++ b/mail/e-mail-request.c
@@ -284,7 +284,25 @@ mail_request_process_contact_photo_sync (EContentRequest *request,
}
}
- return success;
+ if (!success) {
+ GdkPixbuf *pixbuf;
+ gchar *buffer;
+ gsize length;
+
+ g_clear_error (error);
+
+ /* Construct empty image stream, to not show "broken image" icon when no contact photo is
found */
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
+ gdk_pixbuf_fill (pixbuf, 0x00000000); /* transparent black */
+ gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &length, "png", NULL, NULL);
+ g_object_unref (pixbuf);
+
+ *out_stream = g_memory_input_stream_new_from_data (buffer, length, g_free);
+ *out_stream_length = length;
+ *out_mime_type = g_strdup ("image/png");
+ }
+
+ return TRUE;
}
typedef struct _MailIdleData
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]