/* Add attachments to the view */
modest_attachments_view_set_message (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), msg);
- if (priv->attachments == NULL)
- gtk_widget_hide_all (priv->attachments_caption);
+ priv->attachments = modest_attachments_view_get_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view));
+ if (priv->attachments == NULL) {
+ gtk_widget_hide (priv->attachments_caption);
+ } else {
+ gtk_widget_set_no_show_all (priv->attachments_caption, FALSE);
+ gtk_widget_show_all (priv->attachments_caption);
+ }
gtk_text_buffer_get_start_iter (priv->text_buffer, &iter);
gtk_text_buffer_place_cursor (priv->text_buffer, &iter);
modest_attachments_view_remove_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view),
mime_part);
+ if (priv->attachments == NULL)
+ gtk_widget_hide (priv->attachments_caption);
att_id = tny_mime_part_get_content_id (mime_part);
if (att_id != NULL)
text_buffer_delete_images_by_id (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body)),
return selection;
}
+GList *
+modest_attachments_view_get_attachments (ModestAttachmentsView *atts_view)
+{
+ ModestAttachmentsViewPrivate *priv;
+ GList *children, *node, *att_list = NULL;
+
+ g_return_val_if_fail (MODEST_IS_ATTACHMENTS_VIEW (atts_view), NULL);
+ priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (atts_view);
+
+ children = gtk_container_get_children (GTK_CONTAINER (priv->box));
+ for (node = children; node != NULL; node = g_list_next (node)) {
+ GtkWidget *att_view = GTK_WIDGET (node->data);
+ TnyMimePart *mime_part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (att_view));
+ att_list = g_list_prepend (att_list, mime_part);
+ }
+ g_list_free (children);
+ att_list = g_list_reverse (att_list);
+ return att_list;
+
+}
+
void
modest_attachments_view_select_all (ModestAttachmentsView *atts_view)
{
void modest_attachments_view_add_attachment (ModestAttachmentsView *attachments_view, TnyMimePart *part);
void modest_attachments_view_remove_attachment (ModestAttachmentsView *attachments_view, TnyMimePart *part);
void modest_attachments_view_remove_attachment_by_id (ModestAttachmentsView *attachments_view, const gchar *att_id);
+GList *modest_attachments_view_get_attachments (ModestAttachmentsView *attachments_view);
GList *modest_attachments_view_get_selection (ModestAttachmentsView *attachments_view);
void modest_attachments_view_select_all (ModestAttachmentsView *attachments_view);