From e468d62e86da9f16820ac0cc8d7d1f106bf080bf Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Fri, 20 Mar 2009 14:57:26 +0000 Subject: [PATCH] Added API to ModestAccountProtocol to fetch icons pmo-trunk-r8270 --- src/modest-account-protocol.c | 23 +++++++++++++++++++++++ src/modest-account-protocol.h | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/modest-account-protocol.c b/src/modest-account-protocol.c index 203edfc..70d8d24 100644 --- a/src/modest-account-protocol.c +++ b/src/modest-account-protocol.c @@ -98,6 +98,10 @@ static gchar *modest_account_protocol_get_signature_default (ModestAccountProtoc const gchar *account_id, const gchar *mailbox, gboolean *has_signature); +static const GdkPixbuf *modest_account_protocol_get_icon_default (ModestAccountProtocol *self, + ModestAccountProtocolIconType icon_type, + GObject *object, + guint icon_size); /* globals */ @@ -192,6 +196,8 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass) modest_account_protocol_get_from_list_default; account_class->get_signature = modest_account_protocol_get_signature_default; + account_class->get_icon = + modest_account_protocol_get_icon_default; } static void @@ -683,3 +689,20 @@ modest_account_protocol_get_signature_default (ModestAccountProtocol *self, return NULL; } +const GdkPixbuf* +modest_account_protocol_get_icon (ModestAccountProtocol *self, + ModestAccountProtocolIconType icon_type, + GObject *object, + guint icon_size) +{ + return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->get_icon (self, icon_type, object, icon_size); +} + +static const GdkPixbuf * +modest_account_protocol_get_icon_default (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type, + GObject *object, guint icon_size) +{ + g_return_val_if_fail (MODEST_ACCOUNT_PROTOCOL (self), NULL); + + return NULL; +} diff --git a/src/modest-account-protocol.h b/src/modest-account-protocol.h index 8a513c3..74604b6 100644 --- a/src/modest-account-protocol.h +++ b/src/modest-account-protocol.h @@ -53,6 +53,13 @@ G_BEGIN_DECLS typedef struct _ModestAccountProtocol ModestAccountProtocol; typedef struct _ModestAccountProtocolClass ModestAccountProtocolClass; +typedef enum { + MODEST_ACCOUNT_PROTOCOL_ICON_MAILBOX = 0, + MODEST_ACCOUNT_PROTOCOL_ICON_PROTOCOL, + MODEST_ACCOUNT_PROTOCOL_ICON_ACCOUNT, + MODEST_ACCOUNT_PROTOCOL_ICON_FOLDER, +} ModestAccountProtocolIconType; + typedef void (*ModestAccountProtocolCheckSupportFunc) (ModestAccountProtocol *self, gboolean supported, gpointer userdata); @@ -76,6 +83,8 @@ struct _ModestAccountProtocolClass { gchar * (*get_from) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox); ModestPairList * (*get_from_list) (ModestAccountProtocol *self, const gchar *account_id); gchar * (*get_signature) (ModestAccountProtocol *self, const gchar *account_id, const gchar *mailbox, gboolean *has_signature); + const GdkPixbuf * (*get_icon) (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type, + GObject *object, guint icon_size); }; /** @@ -363,6 +372,22 @@ gchar *modest_account_protocol_get_signature (ModestAccountProtocol *self, const gchar *mailbox, gboolean *has_signature); +/** + * modest_account_protocol_get_icon: + * @self: a #ModestAccountProtocl + * @icon_type: a #ModestAccountProtocolIconType + * @object: a #GObject + * @icon_size: the icon size to get + * + * Returns a @self owned #GdkPixbuf with the icon for @icon_type and @object. @object type + * should match @icon_type. + * + * Returns: a #GdkPixbuf (don't free or manipulate this, just copy) + */ +const GdkPixbuf * modest_account_protocol_get_icon (ModestAccountProtocol *self, ModestAccountProtocolIconType icon_type, + GObject *object, guint icon_size); + + G_END_DECLS #endif /* __MODEST_ACCOUNT_PROTOCOL_H__ */ -- 1.7.9.5