[Bug 20035] Avatar cache reference implementation

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 20 13:29:16 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=20035

--- Comment #8 from Xavier Claessens <xclaesse at gmail.com> 2010-04-20 04:29:15 PDT ---
Extra note for solution 2: I don't think we can call
gdk_pixbuf_new_from_stream() many times on the same GInputStream. I guess the
data in the input stream are consumed the first time it's read.

Extra note for solution 1: For adium theme all we care is the filename and
webkit will load the image itself. So in that case, the read from cache would
be useless, and it would be more efficient to only return filename without
reading the data.

So maybe we could have both a signal "avatar-retrieved" and a property
"avatar-filename". tp_connection_request_avatars() would do:
1) check if the current token is found in cache

1a) found in cache: "notify::avatar-filename" is emitted, if there are
listeners for "avatar-retrieved" signal (using g_signal_has_handler_pending)
then as extra step the file is read and "avatar-retrieved" signal is emitted
once data is in memory.

1b) not found in cache: avatar is requested from CM. When CM emits
"AvatarRetrieved" then TpContact::avatar-retrieved is emitted with the data in
memory (no need of using g_signal_has_handler_pending since it is cheap to just
pass the data pointer) and data is stored in cache. Once the write in cache is
done, "notify::avatar-filename" is emitted.

2) The avatar filename could be kept inside TpContact, and could be returned
any time using tp_contact_get_avatar_filename() but is reset to NULL each time
the token is modified. If avatar-filename is NULL then the user knows he has to
first call tp_connection_request_avatars(). If it is known to have no avatar
then filename is "" (to be consistent with "avatar-token").

Does that looks good now?

Also I'm wondering if we should change tp_connection_request_avatars() to
tp_contact_request_avatar() since requests are aggregated anyway internally. Or
we could have both because the former is convenient together with
tp_connection_get_contacts_by_id/handle() when fetching the set of contacts the
first time, and the second is convenient when getting "notify::avatar-token"
for a single contact.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list