X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-attachments-view.c;h=b52b543b6edfeda75df89bb0ea7acc61b045d933;hb=61bbe9ed9335ddcc1957bf8c3158975139c794a7;hp=69c0d164f253c111edcf9906a0874f52f60b2ac2;hpb=bbd6e536bd3f489fe660b49e074805c3e0a501e9;p=modest diff --git a/src/widgets/modest-attachments-view.c b/src/widgets/modest-attachments-view.c index 69c0d16..b52b543 100644 --- a/src/widgets/modest-attachments-view.c +++ b/src/widgets/modest-attachments-view.c @@ -76,7 +76,6 @@ static void set_selected (ModestAttachmentsView *atts_view, ModestAttachmentView static void select_range (ModestAttachmentsView *atts_view, ModestAttachmentView *att1, ModestAttachmentView *att2); static void clipboard_get (GtkClipboard *clipboard, GtkSelectionData *selection_data, guint info, gpointer userdata); -static void clipboard_clear (GtkClipboard *clipboard, gpointer userdata); static void own_clipboard (ModestAttachmentsView *atts_view); static guint signals[LAST_SIGNAL] = {0}; @@ -101,13 +100,14 @@ modest_attachments_view_new (TnyMsg *msg) return GTK_WIDGET (self); } + void modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, TnyMsg *msg) { ModestAttachmentsViewPrivate *priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (attachments_view); TnyList *parts; TnyIterator *iter; - const gchar *msg_content_type = NULL; + gchar *msg_content_type = NULL; if (msg == priv->msg) return; @@ -129,20 +129,18 @@ modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, Tn /* If the top mime part is a multipart/related, we don't show the attachments, as they're * embedded images in body */ - msg_content_type = tny_mime_part_get_content_type (TNY_MIME_PART (priv->msg)); + msg_content_type = modest_tny_mime_part_get_content_type (TNY_MIME_PART (priv->msg)); if ((msg_content_type != NULL) && !strcasecmp (msg_content_type, "multipart/related")) { gchar *header_content_type; - gchar *header_content_type_lower; gboolean application_multipart = FALSE; - header_content_type = modest_tny_mime_part_get_header_value (TNY_MIME_PART (priv->msg), "Content-Type"); - header_content_type = g_strstrip (header_content_type); - header_content_type_lower = (header_content_type ) ? - g_ascii_strdown (header_content_type, -1) : NULL; + + g_free (msg_content_type); + + header_content_type = modest_tny_mime_part_get_headers_content_type (TNY_MIME_PART (priv->msg)); - if ((header_content_type_lower != NULL) && - !strstr (header_content_type_lower, "application/")) { + if ((header_content_type != NULL) && + !strstr (header_content_type, "application/")) { application_multipart = TRUE; - g_free (header_content_type_lower); } g_free (header_content_type); @@ -151,14 +149,14 @@ modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, Tn return; } } else { - gchar *lower; gboolean direct_attach; - lower = g_ascii_strdown (msg_content_type, -1); - direct_attach = (!g_str_has_prefix (lower, "message/rfc822") && - !g_str_has_prefix (lower, "multipart") && - !g_str_has_prefix (lower, "text/")); - g_free (lower); + direct_attach = (!g_str_has_prefix (msg_content_type, "message/rfc822") && + !g_str_has_prefix (msg_content_type, "multipart") && + !g_str_has_prefix (msg_content_type, "text/")); + + g_free (msg_content_type); + if (direct_attach) { modest_attachments_view_add_attachment (attachments_view, TNY_MIME_PART (msg), TRUE, 0); gtk_widget_queue_draw (GTK_WIDGET (attachments_view)); @@ -208,6 +206,7 @@ modest_attachments_view_add_attachment (ModestAttachmentsView *attachments_view, modest_attachment_view_set_size (MODEST_ATTACHMENT_VIEW (att_view), size); gtk_box_pack_end (GTK_BOX (priv->box), att_view, FALSE, FALSE, 0); gtk_widget_show_all (att_view); + gtk_widget_queue_resize (GTK_WIDGET (attachments_view)); } void @@ -259,6 +258,7 @@ modest_attachments_view_remove_attachment (ModestAttachmentsView *atts_view, Tny own_clipboard (atts_view); } + gtk_widget_queue_resize (GTK_WIDGET (atts_view)); } void @@ -289,6 +289,7 @@ modest_attachments_view_remove_attachment_by_id (ModestAttachmentsView *atts_vie own_clipboard (atts_view); + gtk_widget_queue_resize (GTK_WIDGET (atts_view)); } static void