From f77a83e8759912bc74029e29effe1f0d20876965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Wed, 27 Jun 2012 14:08:03 +0200 Subject: Display local contact photos in EContactEditor's EImageChooser Some contacts have photos stored locally as files. Until now EContactEditor displayed thumbnail of contact photo in EImageChooser only if the photo was embedded in the vCard as data. This patch adds support for dispalying thumbnails of photos stored in local files to indicate that the contact has a picture set. --- addressbook/gui/contact-editor/e-contact-editor.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'addressbook/gui/contact-editor') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 16ee8690c7..44fd081fe4 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -2612,14 +2612,25 @@ fill_in_simple_field (EContactEditor *editor, } else if (E_IS_IMAGE_CHOOSER (widget)) { EContactPhoto *photo = e_contact_get (contact, field_id); + editor->image_set = FALSE; if (photo && photo->type == E_CONTACT_PHOTO_TYPE_INLINED) { e_image_chooser_set_image_data ( E_IMAGE_CHOOSER (widget), (gchar *) photo->data.inlined.data, photo->data.inlined.length); editor->image_set = TRUE; + } else if (photo && photo->type == E_CONTACT_PHOTO_TYPE_URI) { + gchar *file_name = g_filename_from_uri (photo->data.uri, NULL, NULL); + if (file_name) { + e_image_chooser_set_from_file ( + E_IMAGE_CHOOSER (widget), + file_name); + editor->image_set = TRUE; + g_free (file_name); + } } - else { + + if (!editor->image_set) { gchar *file_name; file_name = e_icon_factory_get_icon_filename ( @@ -2629,6 +2640,7 @@ fill_in_simple_field (EContactEditor *editor, editor->image_set = FALSE; g_free (file_name); } + editor->image_changed = FALSE; e_contact_photo_free (photo); -- cgit v1.2.3