aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-03-13 22:56:58 +0800
committerMilan Crha <mcrha@redhat.com>2014-03-13 22:56:58 +0800
commit3e8d9c084209a95f14518ec3fbfab4840a44f1cc (patch)
tree9eae8d4047e7fa2700dc1cfd651ba5b688b7175f
parent7749f1a1c6035e87c2f5b8620d08954e70af2e6d (diff)
downloadgsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar.gz
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar.bz2
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar.lz
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar.xz
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.tar.zst
gsoc2013-evolution-3e8d9c084209a95f14518ec3fbfab4840a44f1cc.zip
Contact photos not always shown in a contact preview
Locally stored photos were shown as a "missing image" instead of the actual photo for cases when the URL contained special characters which required to be encoded in the URL. This effectively updates commit 255e0529040baae67e3d70f1030ce248fd61856d, to check WebKit version for the unescape, because WebKit 2.2.5 (which I currently use) doesn't re-escape the URIs. Maybe earlier versions of the WebKit do the same.
-rw-r--r--addressbook/gui/widgets/eab-contact-formatter.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index 5b61bcde19..f4b24a21bc 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -397,11 +397,18 @@ render_title_block (EABContactFormatter *formatter,
photo_data);
} else if (photo && photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri && *photo->data.uri) {
gboolean is_local = g_str_has_prefix (photo->data.uri, "file://");
+ const gchar *uri = photo->data.uri;
+ /* WebKit 2.2 doesn't re-escape URIs, thus do this only for versions before this */
+ #if !WEBKIT_CHECK_VERSION(2,2,0)
gchar *unescaped = g_uri_unescape_string (photo->data.uri, NULL);
+ uri = unescaped;
+ #endif
g_string_append_printf (
buffer, "<img border=\"1\" src=\"%s%s\">",
- is_local ? "evo-" : "", unescaped);
+ is_local ? "evo-" : "", uri);
+ #if !WEBKIT_CHECK_VERSION(2,2,0)
g_free (unescaped);
+ #endif
}
if (photo)
@@ -871,13 +878,20 @@ render_compact (EABContactFormatter *formatter,
if (photo->type == E_CONTACT_PHOTO_TYPE_URI &&
photo->data.uri && *photo->data.uri) {
gboolean is_local = g_str_has_prefix (photo->data.uri, "file://");
+ const gchar *uri = photo->data.uri;
+ /* WebKit 2.2 doesn't re-escape URIs, thus do this only for versions before this */
+ #if !WEBKIT_CHECK_VERSION(2,2,0)
gchar *unescaped = g_uri_unescape_string (photo->data.uri, NULL);
+ uri = unescaped;
+ #endif
g_string_append_printf (
buffer,
"<img width=\"%d\" height=\"%d\" src=\"%s%s\">",
calced_width, calced_height,
- is_local ? "evo-" : "", unescaped);
+ is_local ? "evo-" : "", uri);
+ #if !WEBKIT_CHECK_VERSION(2,2,0)
g_free (unescaped);
+ #endif
} else {
gchar *photo_data;