static gboolean _folder_is_any_of_type (TnyFolder *folder, TnyFolderType types[], guint ntypes);
static gboolean _invalid_msg_selected (ModestMainWindow *win, gboolean unique, ModestDimmingRule *rule);
-static gboolean _invalid_attach_selected (ModestWindow *win, gboolean unique, gboolean for_view, ModestDimmingRule *rule);
+static gboolean _invalid_attach_selected (ModestWindow *win,
+ gboolean unique, gboolean for_view, gboolean for_remove,
+ ModestDimmingRule *rule);
static gboolean _purged_attach_selected (ModestWindow *win, gboolean all, ModestDimmingRule *rule);
static gboolean _clipboard_is_empty (ModestWindow *win);
static gboolean _invalid_clipboard_selected (ModestWindow *win, ModestDimmingRule *rule);
/* Check dimmed rule */
if (!dimmed)
- dimmed = _invalid_attach_selected (win, TRUE, TRUE, rule);
+ dimmed = _invalid_attach_selected (win, TRUE, TRUE, FALSE, rule);
if (!dimmed) {
dimmed = _purged_attach_selected (win, FALSE, NULL);
/* Check dimmed rule */
if (!dimmed)
- dimmed = _invalid_attach_selected (win, FALSE, FALSE, rule);
+ dimmed = _invalid_attach_selected (win, FALSE, FALSE, FALSE, rule);
if (!dimmed) {
dimmed = _purged_attach_selected (win, FALSE, NULL);
/* Check in view window if there's any attachment selected */
if (!dimmed && MODEST_IS_MSG_VIEW_WINDOW (win)) {
- dimmed = _invalid_attach_selected (win, FALSE, FALSE, NULL);
+ dimmed = _invalid_attach_selected (win, FALSE, FALSE, TRUE, NULL);
if (dimmed)
modest_dimming_rule_set_notification (rule, _("FIXME:no attachment selected"));
}
_invalid_attach_selected (ModestWindow *win,
gboolean unique,
gboolean for_view,
+ gboolean for_remove,
ModestDimmingRule *rule)
{
GList *attachments, *node;
for (node = attachments; node != NULL && !result; node = g_list_next (node)) {
TnyMimePart *mime_part = TNY_MIME_PART (node->data);
TnyList *nested_list = tny_simple_list_new ();
- if (TNY_IS_MSG (mime_part)) {
+ if (!for_remove && TNY_IS_MSG (mime_part)) {
selected_messages = TRUE;
result = TRUE;
}
tny_mime_part_get_parts (mime_part, nested_list);
- if (tny_list_get_length (nested_list) > 0) {
- nested_attachments = TRUE;
- result = TRUE;
+ if (!for_remove && tny_list_get_length (nested_list) > 0) {
+ nested_attachments = TRUE;
+ result = TRUE;
}
g_object_unref (nested_list);
}
priv->size = 0;
priv->is_purged = tny_mime_part_is_purged (mime_part);
-
- if (priv->is_purged) {
- filename = g_strdup( tny_mime_part_get_filename (mime_part));
- if (filename == NULL)
- filename = g_strdup ("");
- file_icon_name = modest_platform_get_file_icon_name (NULL, NULL, NULL);
- } else if (TNY_IS_MSG (mime_part)) {
+
+ if (TNY_IS_MSG (mime_part)) {
TnyHeader *header = tny_msg_get_header (TNY_MSG (mime_part));
if (TNY_IS_HEADER (header)) {
filename = g_strdup (tny_header_get_subject (header));
if (filename == NULL)
filename = g_strdup (_("mail_va_no_subject"));
- file_icon_name = modest_platform_get_file_icon_name (NULL, tny_mime_part_get_content_type (mime_part), NULL);
+ if (priv->is_purged)
+ file_icon_name = modest_platform_get_file_icon_name (NULL, NULL, NULL);
+ else
+ file_icon_name =
+ modest_platform_get_file_icon_name (
+ NULL, tny_mime_part_get_content_type (mime_part), NULL);
g_object_unref (header);
}
} else {
filename = g_strdup (tny_mime_part_get_filename (mime_part));
- file_icon_name = modest_platform_get_file_icon_name (filename,
- tny_mime_part_get_content_type (mime_part),
- NULL);
- show_size = TRUE;
+ if (priv->is_purged) {
+ file_icon_name = modest_platform_get_file_icon_name (NULL, NULL, NULL);
+ } else {
+ file_icon_name = modest_platform_get_file_icon_name (
+ filename, tny_mime_part_get_content_type (mime_part), NULL);
+ show_size = TRUE;
+ }
}
if (file_icon_name) {