aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-06-27 20:08:03 +0800
committerDan Vrátil <dvratil@redhat.com>2012-06-27 20:18:39 +0800
commitf77a83e8759912bc74029e29effe1f0d20876965 (patch)
tree0e944eb0c65954398249b760dd487a9f2e462eeb /addressbook/gui/contact-editor
parent2a86155e711e620bcfb1bb3dcfe1782991f0dc5c (diff)
downloadgsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar.gz
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar.bz2
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar.lz
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar.xz
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.tar.zst
gsoc2013-evolution-f77a83e8759912bc74029e29effe1f0d20876965.zip
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.
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c14
1 files changed, 13 insertions, 1 deletions
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);