Detect calendar status from parts in header view
authorJosé Dapena Paz <jdapena@igalia.com>
Thu, 17 Dec 2009 16:29:25 +0000 (17:29 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Mon, 18 Jan 2010 15:49:56 +0000 (16:49 +0100)
src/modest-tny-msg.h
src/widgets/modest-gtkhtml-msg-view.c

index c4fcd3a..b28c026 100644 (file)
@@ -127,7 +127,7 @@ TnyMimePart*  modest_tny_msg_find_body_part  (TnyMsg * self, gboolean want_html)
  * 
  * Returns: the TnyMimePart for the found part, or NULL if no matching part is found
  */     
-TnyMimePart* modest_tny_msg_find_calendar_part (TnyMsg *self);
+TnyMimePart* modest_tny_msg_find_calendar (TnyMsg *self);
 
 
 /**
index 242ed2d..9941c1e 100644 (file)
@@ -1251,6 +1251,7 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
                gtk_widget_hide_all (priv->priority_box);
        }
        priv->calendar_icon = gtk_image_new ();
+       gtk_image_set_from_icon_name (GTK_IMAGE (priv->calendar_icon), MODEST_HEADER_ICON_CALENDAR, GTK_ICON_SIZE_MENU);
        gtk_misc_set_alignment (GTK_MISC (priv->calendar_icon), 0.0, 0.5);
        if (priv->calendar_icon) {
                priv->calendar_box = (GtkWidget *)
@@ -2787,10 +2788,19 @@ static void
 set_calendar (ModestGtkhtmlMsgView *self, TnyHeader *header, TnyMsg *msg)
 {
        ModestGtkhtmlMsgViewPrivate *priv;
+       TnyMimePart *calendar_part;
 
        g_return_if_fail (MODEST_IS_GTKHTML_MSG_VIEW (self));
        priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
 
+       calendar_part = modest_tny_msg_find_calendar (TNY_MSG (msg));
+
+       if (calendar_part) {
+               gtk_widget_show_all  (priv->calendar_box);
+               g_object_unref (calendar_part);
+       } else {
+               gtk_widget_hide_all (priv->calendar_box);
+       }
        
 
 }