+#include <modest-platform.h>
+#include <string.h>
+
+static GdkPixbuf*
+get_pixbuf_for_flag (TnyHeaderFlags flag)
+{
+ /* optimization */
+ static GdkPixbuf *deleted_pixbuf = NULL;
+ static GdkPixbuf *seen_pixbuf = NULL;
+ static GdkPixbuf *unread_pixbuf = NULL;
+ static GdkPixbuf *attachments_pixbuf = NULL;
+ static GdkPixbuf *high_pixbuf = NULL;
+ static GdkPixbuf *low_pixbuf = NULL;
+
+ switch (flag) {
+ case TNY_HEADER_FLAG_DELETED:
+ if (G_UNLIKELY(!deleted_pixbuf))
+ deleted_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_DELETED);
+ return deleted_pixbuf;
+ case TNY_HEADER_FLAG_SEEN:
+ if (G_UNLIKELY(!seen_pixbuf))
+ seen_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_READ);
+ return seen_pixbuf;
+ case TNY_HEADER_FLAG_ATTACHMENTS:
+ if (G_UNLIKELY(!attachments_pixbuf))
+ attachments_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_ATTACH);
+ return attachments_pixbuf;
+ case TNY_HEADER_FLAG_HIGH_PRIORITY:
+ if (G_UNLIKELY(!high_pixbuf))
+ high_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_HIGH_PRIORITY);
+ return high_pixbuf;
+ case TNY_HEADER_FLAG_LOW_PRIORITY:
+ if (G_UNLIKELY(!low_pixbuf))
+ low_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_LOW_PRIORITY);
+ return low_pixbuf;
+ default:
+ if (G_UNLIKELY(!unread_pixbuf))
+ unread_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_UNREAD);
+ return unread_pixbuf;
+ }
+}
+
+static void
+set_common_flags (GtkCellRenderer *renderer, TnyHeaderFlags flags)
+{
+ g_object_set (G_OBJECT(renderer),
+ "weight", (flags & TNY_HEADER_FLAG_SEEN) ? PANGO_WEIGHT_NORMAL: PANGO_WEIGHT_ULTRABOLD,
+ "strikethrough", (flags & TNY_HEADER_FLAG_DELETED) ? TRUE:FALSE,
+ NULL);
+}