[evolution/webkit: 165/171] Fix vcard-inline plugin
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 165/171] Fix vcard-inline plugin
- Date: Fri, 24 Feb 2012 12:48:20 +0000 (UTC)
commit 81bb79990ebe688336308fd8c7b0b6d0980c6e58
Author: Dan VrÃtil <dvratil redhat com>
Date: Tue Feb 21 16:37:36 2012 +0100
Fix vcard-inline plugin
addressbook/gui/widgets/eab-contact-display.c | 21 +++++++++++++--------
plugins/vcard-inline/vcard-inline.c | 21 ++++++++++++++++++++-
2 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 61518e6..362b136 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -809,8 +809,6 @@ static void
eab_contact_display_render_compact (EABContactDisplay *display,
EContact *contact)
{
-#warning FIXME: eab_contact_display_render_compact is not WebKit-ready
-
GString *buffer;
@@ -908,12 +906,18 @@ eab_contact_display_render_compact (EABContactDisplay *display,
buffer,
"<img width=\"%d\" height=\"%d\" src=\"%s\">",
calced_width, calced_height, photo->data.uri);
- else
- g_string_append_printf (
- buffer,
- "<object width=\"%d\" height=\"%d\" "
- "type=\"image/x-contact-photo\"/>",
+ else {
+ gchar *photo_data = g_base64_encode (
+ photo->data.inlined.data,
+ photo->data.inlined.length);
+ g_string_append_printf (buffer,
+ "<img border=\"1\" src=\"data:%s;base64,%s\" "
+ "width=\"%d\" height=\"%d\">",
+ photo->data.inlined.mime_type,
+ photo_data,
calced_width, calced_height);
+ g_free (photo_data);
+ }
e_contact_photo_free (photo);
}
@@ -1206,10 +1210,11 @@ contact_display_object_requested (WebKitWebView *web_view,
contact_uid, address, NULL);
gtk_widget_show_all (map);
+
+ e_contact_address_free (address);
}
g_free (full_name);
- e_contact_address_free (address);
return map;
}
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 3c9b24a..9cad663 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -24,7 +24,6 @@
#include <glib/gi18n-lib.h>
#include <libebook/e-book-client.h>
#include <libebook/e-contact.h>
-#include <gtkhtml/gtkhtml-embedded.h>
#include <libedataserverui/e-client-utils.h>
#include <libedataserverui/e-source-selector-dialog.h>
@@ -314,6 +313,25 @@ org_gnome_vcard_inline_embed (EMFormat *emf,
return layout;
}
+static void
+write_vcard_inline_display (EMFormat *emf,
+ EMFormatPURI *puri,
+ CamelStream *stream,
+ EMFormatWriterInfo *info,
+ GCancellable *cancellable)
+{
+ gchar *str;
+
+ str = g_strdup_printf (
+ "<object type=\"application/x-org-gnome-vcard-display\" "
+ "height=\"100\" width=\"100%%\" "
+ "data=\"%s\" id=\"%s\"></object>", puri->uri, puri->uri);
+
+ camel_stream_write_string (stream, str, cancellable, NULL);
+
+ g_free (str);
+}
+
void
org_gnome_vcard_inline_format (gpointer ep,
EMFormatHookTarget *target)
@@ -328,6 +346,7 @@ org_gnome_vcard_inline_format (gpointer ep,
vcard_object = (VCardInlinePURI *) em_format_puri_new (
target->format, sizeof(VCardInlinePURI), target->part, classid);
vcard_object->puri.widget_func = org_gnome_vcard_inline_embed;
+ vcard_object->puri.write_func = write_vcard_inline_display;
vcard_object->puri.free = org_gnome_vcard_inline_pobject_free;
em_format_add_puri (target->format, (EMFormatPURI *) vcard_object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]