Reimplement EPhotoCache to use EPhotoSource.

Reimplement EPhotoCache to delegate the actual photo fetching to
EPhotoSources.  When a photo is requested for a given email address,
all available EPhotoSources are dispatched concurrently and a photo
input stream is selected from the result set.

This also utilizes EDataCapture, which is affixed to the returned
GInputStream to capture and cache photo data for an email address.

New functions:

    e_photo_cache_add_photo_source()
    e_photo_cache_list_photo_sources()
    e_photo_cache_remove_photo_source()
    e_photo_cache_add_photo()

Renamed functions:

    e_photo_cache_remove() --> e_photo_cache_remove_photo()
This commit is contained in:
Matthew Barnes
2013-04-22 20:28:14 -04:00
parent 822fcbbd0f
commit 3bf02daa08
4 changed files with 666 additions and 284 deletions

View File

@ -2489,10 +2489,14 @@ e_passwords_ask_password
EPhotoCache
e_photo_cache_new
e_photo_cache_ref_client_cache
e_photo_cache_add_photo_source
e_photo_cache_list_photo_sources
e_photo_cache_remove_photo_source
e_photo_cache_add_photo
e_photo_cache_remove_photo
e_photo_cache_get_photo_sync
e_photo_cache_get_photo
e_photo_cache_get_photo_finish
e_photo_cache_remove
<SUBSECTION Standard>
E_PHOTO_CACHE
E_IS_PHOTO_CACHE

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
#include <libebook/libebook.h>
#include <e-util/e-client-cache.h>
#include <e-util/e-photo-source.h>
/* Standard GObject macros */
#define E_TYPE_PHOTO_CACHE \
@ -69,6 +70,18 @@ struct _EPhotoCacheClass {
GType e_photo_cache_get_type (void) G_GNUC_CONST;
EPhotoCache * e_photo_cache_new (EClientCache *client_cache);
EClientCache * e_photo_cache_ref_client_cache (EPhotoCache *photo_cache);
void e_photo_cache_add_photo_source (EPhotoCache *photo_cache,
EPhotoSource *photo_source);
GList * e_photo_cache_list_photo_sources
(EPhotoCache *photo_cache);
gboolean e_photo_cache_remove_photo_source
(EPhotoCache *photo_cache,
EPhotoSource *photo_source);
void e_photo_cache_add_photo (EPhotoCache *photo_cache,
const gchar *email_address,
GBytes *bytes);
gboolean e_photo_cache_remove_photo (EPhotoCache *photo_cache,
const gchar *email_address);
gboolean e_photo_cache_get_photo_sync (EPhotoCache *photo_cache,
const gchar *email_address,
GCancellable *cancellable,
@ -83,8 +96,6 @@ gboolean e_photo_cache_get_photo_finish (EPhotoCache *photo_cache,
GAsyncResult *result,
GInputStream **out_stream,
GError **error);
gboolean e_photo_cache_remove (EPhotoCache *photo_cache,
const gchar *email_address);
G_END_DECLS

View File

@ -199,7 +199,7 @@ action_mail_add_sender_cb (GtkAction *action,
photo_cache = e_mail_ui_session_get_photo_cache (
E_MAIL_UI_SESSION (session));
camel_internet_address_get (cia, 0, NULL, &address_only);
e_photo_cache_remove (photo_cache, address_only);
e_photo_cache_remove_photo (photo_cache, address_only);
}
g_object_unref (cia);
@ -261,7 +261,7 @@ action_add_to_address_book_cb (GtkAction *action,
photo_cache = e_mail_ui_session_get_photo_cache (
E_MAIL_UI_SESSION (session));
camel_internet_address_get (cia, 0, NULL, &address_only);
e_photo_cache_remove (photo_cache, address_only);
e_photo_cache_remove_photo (photo_cache, address_only);
g_object_unref (cia);