+ self = MODEST_FOLDER_VIEW (data);
+ priv = MODEST_FOLDER_VIEW_GET_PRIVATE (self);
+
+
+ if (type != TNY_FOLDER_TYPE_ROOT) {
+ gint number = 0;
+ gboolean drafts;
+
+ if (modest_tny_folder_is_local_folder (TNY_FOLDER (instance)) ||
+ modest_tny_folder_is_memory_card_folder (TNY_FOLDER (instance))) {
+ type = modest_tny_folder_get_local_or_mmc_folder_type (TNY_FOLDER (instance));
+ } else {
+ /* Sometimes an special folder is reported by the server as
+ NORMAL, like some versions of Dovecot */
+ if (type == TNY_FOLDER_TYPE_NORMAL ||
+ type == TNY_FOLDER_TYPE_UNKNOWN) {
+ type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));
+ }
+ }
+
+ /* note: we cannot reliably get the counts from the tree model, we need
+ * to use explicit calls on tny_folder for some reason.
+ */
+ /* Select the number to show: the unread or unsent messages. in case of outbox/drafts, show all */
+ if ((type == TNY_FOLDER_TYPE_DRAFTS) ||
+ (type == TNY_FOLDER_TYPE_OUTBOX) ||
+ (type == TNY_FOLDER_TYPE_MERGE)) { /* _OUTBOX actually returns _MERGE... */
+ number = tny_folder_get_all_count (TNY_FOLDER(instance));
+ drafts = TRUE;
+ } else {
+ number = tny_folder_get_unread_count (TNY_FOLDER(instance));
+ drafts = FALSE;
+ }
+
+ if (priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT) {
+ if (number > 0) {
+ item_name = g_strdup_printf (drafts?_("mcen_ti_messages"):_("mcen_ti_new_messages"),
+ number);
+ }
+ }
+
+ }
+
+ if (!item_name)
+ item_name = g_strdup ("");
+
+ if (item_name) {
+ /* Set the name in the treeview cell: */
+ g_object_set (rendobj,"text", item_name, NULL);
+
+ g_free (item_name);
+
+ }
+
+ end:
+ if (instance)
+ g_object_unref (G_OBJECT (instance));
+}
+
+
+typedef struct {
+ GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf_open;
+ GdkPixbuf *pixbuf_close;
+} ThreePixbufs;
+
+
+static inline GdkPixbuf *
+get_composite_pixbuf (const gchar *icon_name,
+ const gint size,
+ GdkPixbuf *base_pixbuf)
+{
+ GdkPixbuf *emblem, *retval = NULL;
+
+ emblem = modest_platform_get_icon (icon_name, size);
+ if (emblem) {
+ retval = gdk_pixbuf_copy (base_pixbuf);
+ gdk_pixbuf_composite (emblem, retval, 0, 0,
+ MIN (gdk_pixbuf_get_width (emblem),
+ gdk_pixbuf_get_width (retval)),
+ MIN (gdk_pixbuf_get_height (emblem),
+ gdk_pixbuf_get_height (retval)),
+ 0, 0, 1, 1, GDK_INTERP_NEAREST, 255);
+ g_object_unref (emblem);
+ }
+ return retval;
+}
+
+static inline ThreePixbufs *
+get_composite_icons (const gchar *icon_code,
+ GdkPixbuf **pixbuf,
+ GdkPixbuf **pixbuf_open,
+ GdkPixbuf **pixbuf_close)
+{
+ ThreePixbufs *retval;