aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-11-02 21:41:55 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-11-02 21:41:55 +0800
commit0849af1df6b923a534b3982406d690bb344355ab (patch)
treea85e9a409d0da412f7e84b218a0c46f6ad5141df /addressbook
parent5182ae7cef949001e6aa8b36f1c8fa1694570f98 (diff)
parentbcf8dbb96f31e1b7fcca3a179f64885ca04ff565 (diff)
downloadgsoc2013-evolution-0849af1df6b923a534b3982406d690bb344355ab.tar.gz
gsoc2013-evolution-0849af1df6b923a534b3982406d690bb344355ab.tar.zst
gsoc2013-evolution-0849af1df6b923a534b3982406d690bb344355ab.zip
Merge branch 'master' into wip/gsettings
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c43
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c1
-rw-r--r--addressbook/util/eab-book-util.c1
3 files changed, 36 insertions, 9 deletions
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index da558352bb..d428f8ed77 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -427,6 +427,8 @@ render_title_block (GString *buffer,
/* Only handle inlined photos for now */
if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
g_string_append (buffer, "<img border=\"1\" src=\"internal-contact-photo:\">");
+ } else if (photo && photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri && *photo->data.uri) {
+ g_string_append_printf (buffer, "<img border=\"1\" src=\"%s\">", photo->data.uri);
}
if (photo)
e_contact_photo_free (photo);
@@ -929,7 +931,22 @@ eab_contact_display_render_compact (EABContactDisplay *display,
* 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);
+ if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
+ gdk_pixbuf_loader_write (loader, photo->data.inlined.data, photo->data.inlined.length, NULL);
+ } else if (photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri &&
+ g_ascii_strncasecmp (photo->data.uri, "file://", 7) == 0) {
+ gchar *filename, *contents = NULL;
+ gsize length;
+
+ filename = g_filename_from_uri (photo->data.uri, NULL, NULL);
+ if (filename) {
+ if (g_file_get_contents (filename, &contents, &length, NULL)) {
+ gdk_pixbuf_loader_write (loader, (const guchar *) contents, length, NULL);
+ g_free (contents);
+ }
+ g_free (filename);
+ }
+ }
gdk_pixbuf_loader_close (loader, NULL);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf)
@@ -949,13 +966,20 @@ eab_contact_display_render_compact (EABContactDisplay *display,
calced_width *= ((gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension);
calced_height *= ((gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension);
}
+ g_object_unref (pixbuf);
}
- g_object_unref (pixbuf);
- g_string_append_printf (
- buffer,
- "<img width=\"%d\" height=\"%d\" src=\"internal-contact-photo:\">",
- calced_width, calced_height);
+ if (photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri && *photo->data.uri)
+ g_string_append_printf (
+ buffer,
+ "<img width=\"%d\" height=\"%d\" src=\"%s\">",
+ calced_width, calced_height, photo->data.uri);
+ else
+ g_string_append_printf (
+ buffer,
+ "<img width=\"%d\" height=\"%d\" src=\"internal-contact-photo:\">",
+ calced_width, calced_height);
+
e_contact_photo_free (photo);
}
@@ -1174,9 +1198,10 @@ contact_display_url_requested (GtkHTML *html,
if (photo == NULL)
photo = e_contact_get (contact, E_CONTACT_LOGO);
- gtk_html_stream_write (
- handle, (gchar *) photo->data.inlined.data,
- photo->data.inlined.length);
+ if (photo->type == E_CONTACT_PHOTO_TYPE_INLINED)
+ gtk_html_stream_write (
+ handle, (gchar *) photo->data.inlined.data,
+ photo->data.inlined.length);
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index eb98676169..befc8836ca 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -495,6 +495,7 @@ do_copy (gpointer data,
contact = data;
book_client = process->destination;
+ e_contact_inline_local_photos (contact, NULL);
process->count++;
eab_merging_book_add_contact (
diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c
index eff5fc1058..30cd2acb96 100644
--- a/addressbook/util/eab-book-util.c
+++ b/addressbook/util/eab-book-util.c
@@ -136,6 +136,7 @@ eab_contact_list_to_string (const GSList *contacts)
EContact *contact = l->data;
gchar *vcard_str;
+ e_contact_inline_local_photos (contact, NULL);
vcard_str = e_vcard_to_string (
E_VCARD (contact), EVC_FORMAT_VCARD_30);