", bg_frame, bg_body);
photo = e_contact_get (contact, E_CONTACT_PHOTO);
if (!photo)
photo = e_contact_get (contact, E_CONTACT_LOGO);
if (photo) {
gint calced_width = MAX_COMPACT_IMAGE_DIMENSION, calced_height = MAX_COMPACT_IMAGE_DIMENSION;
GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
GdkPixbuf *pixbuf;
/* figure out if we need to downscale the
image here. we don't scale the pixbuf
itself, just insert width/height tags in
the html */
gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL);
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
g_object_ref (pixbuf);
g_object_unref (loader);
if (pixbuf) {
gint max_dimension;
calced_width = gdk_pixbuf_get_width (pixbuf);
calced_height = gdk_pixbuf_get_height (pixbuf);
max_dimension = calced_width;
if (max_dimension < calced_height)
max_dimension = calced_height;
if (max_dimension > MAX_COMPACT_IMAGE_DIMENSION) {
calced_width *= ((gfloat)MAX_COMPACT_IMAGE_DIMENSION / max_dimension);
calced_height *= ((gfloat)MAX_COMPACT_IMAGE_DIMENSION / max_dimension);
}
}
g_object_unref (pixbuf);
g_string_append_printf (
buffer,
"",
calced_width, calced_height);
e_contact_photo_free (photo);
}
g_string_append (buffer, " | \n");
str = e_contact_get_const (contact, E_CONTACT_FILE_AS);
if (str) {
html = e_text_to_html (str, 0);
g_string_append_printf (buffer, "%s", html);
g_free (html);
}
else {
str = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
if (str) {
html = e_text_to_html (str, 0);
g_string_append_printf (buffer, "%s", html);
g_free (html);
}
}
g_string_append (buffer, " ");
if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
GList *email_list;
GList *l;
g_string_append (buffer, "");
g_string_append_printf (buffer, "%s: | ", _("List Members"));
email_list = e_contact_get (contact, E_CONTACT_EMAIL);
for (l = email_list; l; l = l->next) {
if (l->data) {
html = e_text_to_html (l->data, 0);
g_string_append_printf (buffer, "%s, ", html);
g_free (html);
}
}
g_string_append (buffer, " | ");
}
else {
gboolean comma = FALSE;
str = e_contact_get_const (contact, E_CONTACT_TITLE);
if (str) {
html = e_text_to_html (str, 0);
g_string_append_printf (buffer, "%s: %s ", _("Job Title"), str);
g_free (html);
}
#define print_email() { \
html = eab_parse_qp_email_to_html (str); \
\
if (!html) \
html = e_text_to_html (str, 0); \
\
g_string_append_printf (buffer, "%s%s", comma ? ", " : "", html); \
g_free (html); \
comma = TRUE; \
}
g_string_append_printf (buffer, "%s: ", _("Email"));
str = e_contact_get_const (contact, E_CONTACT_EMAIL_1);
if (str)
print_email ();
str = e_contact_get_const (contact, E_CONTACT_EMAIL_2);
if (str)
print_email ();
str = e_contact_get_const (contact, E_CONTACT_EMAIL_3);
if (str)
print_email ();
g_string_append (buffer, " ");
#undef print_email
str = e_contact_get_const (contact, E_CONTACT_HOMEPAGE_URL);
if (str) {
html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS);
g_string_append_printf (
buffer, "%s: %s ",
_("Home page"), html);
g_free (html);
}
str = e_contact_get_const (contact, E_CONTACT_BLOG_URL);
if (str) {
html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS);
g_string_append_printf (
buffer, "%s: %s ",
_("Blog"), html);
}
}
g_string_append (buffer, " |