X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-folder-view.c;h=6acb296a5a4adadf97ee66731e8e8d30fd99de46;hp=1fc6cf2d3fe248bf2564ed2922375f94c323b6ae;hb=1fb3cf8452c1c10f11c812ab5d14721781fb59dc;hpb=e468d62e86da9f16820ac0cc8d7d1f106bf080bf;ds=sidebyside diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index 1fc6cf2..6acb296 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -62,6 +62,7 @@ #include "modest-dnd.h" #include "modest-ui-constants.h" #include "widgets/modest-window.h" +#include /* Folder view drag types */ const GtkTargetEntry folder_view_drag_types[] = @@ -894,9 +895,38 @@ get_composite_icons (const gchar *icon_code, return retval; } +static inline ThreePixbufs * +get_account_protocol_pixbufs (ModestProtocolType protocol_type, + GObject *object) +{ + ModestProtocol *protocol; + const GdkPixbuf *pixbuf = NULL; + + protocol = modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (), + protocol_type); + + if (MODEST_IS_ACCOUNT_PROTOCOL (protocol)) { + pixbuf = modest_account_protocol_get_icon (MODEST_ACCOUNT_PROTOCOL (protocol), + MODEST_ACCOUNT_PROTOCOL_ICON_FOLDER, + object, FOLDER_ICON_SIZE); + } + + if (pixbuf) { + ThreePixbufs *retval; + retval = g_slice_new0 (ThreePixbufs); + retval->pixbuf = g_object_ref ((GObject *) pixbuf); + retval->pixbuf_open = g_object_ref ((GObject *) pixbuf); + retval->pixbuf_close = g_object_ref ((GObject *) pixbuf); + return retval; + } else { + return NULL; + } +} + static inline ThreePixbufs* get_folder_icons (TnyFolderType type, GObject *instance) { + TnyAccount *account = NULL; static GdkPixbuf *inbox_pixbuf = NULL, *outbox_pixbuf = NULL, *junk_pixbuf = NULL, *sent_pixbuf = NULL, *trash_pixbuf = NULL, *draft_pixbuf = NULL, @@ -917,6 +947,23 @@ get_folder_icons (TnyFolderType type, GObject *instance) ThreePixbufs *retval = NULL; + if (TNY_IS_ACCOUNT (instance)) { + account = g_object_ref (instance); + } else if (TNY_IS_FOLDER (instance)) { + account = tny_folder_get_account (TNY_FOLDER (instance)); + } + + if (account) { + ModestProtocolType account_store_protocol; + + account_store_protocol = modest_tny_account_get_protocol_type (account); + retval = get_account_protocol_pixbufs (account_store_protocol, instance); + g_object_unref (account); + } + + if (retval) + return retval; + /* Sometimes an special folder is reported by the server as NORMAL, like some versions of Dovecot */ if (type == TNY_FOLDER_TYPE_NORMAL ||