GNOME Bugzilla – Bug 674381
Show contact photo from address book doesn't work
Last modified: 2013-09-13 01:06:47 UTC
Summary says it all, show contact photo from address book doesn't work. Steps: a) import attached contact to your addressbook, which is marked for autocompletion b) import attached email c) make sure Edit->preferences->Mail Preferences->Headers has "Show contact photo" checked, I have also "only in local books", as I imported it there [c1) feel free to restart all evolution processes, even it is not required] d) in mailer selected imported message It should show a "photo" from the contact, as 3.4.0 does, but it doesn't.
Created attachment 212345 [details] test vcard
Created attachment 212346 [details] test message
Created attachment 212367 [details] [review] Patch This should make it work. Please try with more various contacts, your addressbook is probably much bigger then mine ;)
Please keep there the check for photo != NULL at: /* keep only up to 10 photos in memory */ - if (photo && count_not_null >= 10 && first_not_null) { + if (count_not_null >= 10 && first_not_null) { pi = first_not_null->data; The search_address_in_addressbooks() can return TRUE, as it found the contact, but the contact can be without photo, while the em_utils_contact_photo() takes care of contacts with photo only. Or, maybe, what was the purpose for this change? Fix added new lines in em-format-html.c, please. There are added too many below efh_constructed. Otherwise looks good. I'm only afraid the change from e-mail-utils.c and movement of e_extensible_load_extensions() should come to gnome-3-4 as well. Could you test it there and possible commit as well, please?
Created attachment 212585 [details] [review] Fixed patch Removed the newlines below constructor. (In reply to comment #4) > Please keep there the check for photo != NULL at: > /* keep only up to 10 photos in memory */ > - if (photo && count_not_null >= 10 && first_not_null) { > + if (count_not_null >= 10 && first_not_null) { > pi = first_not_null->data; > > The search_address_in_addressbooks() can return TRUE, as it found the contact, > but the contact can be without photo, while the em_utils_contact_photo() takes > care of contacts with photo only. Or, maybe, what was the purpose for this > change? The point of this change is to store in the cache (which is a sort of a hashtable email=>photo) even contacts without a picture. The purpose of the cache (at least as I see it) is to speed up lookup of contact photo. If the contact has no photo, we still want to learn about it quickly, without having to search the addressbooks again. > Otherwise looks good. I'm only afraid the change from e-mail-utils.c and > movement of e_extensible_load_extensions() should come to gnome-3-4 as well. > Could you test it there and possible commit as well, please? Looks good, there were no other potentially conflicting changes in e-mail-utils.c since gnome-3-4 branching, so it should apply and work correctly.
(In reply to comment #5) > The point of this change is to store in the cache (which is a sort of a > hashtable email=>photo) even contacts without a picture. > > The purpose of the cache (at least as I see it) is to speed up lookup of > contact photo. If the contact has no photo, we still want to learn about it > quickly, without having to search the addressbooks again. Yup, they are always added to the cache, but only those with picture are removed. That might be the bug you accidentally pointed to. :) So, there is called g_slist_append when adding to photos_cache, thus I would simplify the code to not count_not_null, neither check for first_not_null, but always remove the first item from photos_cache when its size exceeds 10 items. Feel free to just change it and commit. Thanks.
I've fixed the caching to prepend new items and remove the last item when cache is full. Committed all changes to master as 7981771ea6a6ab2729010fc814d427e25f792b31 http://git.gnome.org/browse/evolution/commit/?id=7981771ea6a6ab2729010fc814d427e25f792b31 Committed changes in libemail-engine and EMailFormatter constructor to gnome-3-4 as c219cb1dec286cea39c0a7d8455319c3677d3600 http://git.gnome.org/browse/evolution/commit/?h=gnome-3-4&id=c219cb1dec286cea39c0a7d8455319c3677d3600