From: Sergio Villar Senin Date: Mon, 28 Jul 2008 19:11:51 +0000 (+0000) Subject: * Fixes NB#87161, do not allow to remove nested attachments X-Git-Tag: git_migration_finished~1250 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=0ce7801d90e0ec5887bb636903f7b3d62fae2092 * Fixes NB#87161, do not allow to remove nested attachments pmo-trunk-r5179 --- diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index c739e55..71d32f8 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -1246,6 +1246,26 @@ modest_ui_dimming_rules_on_remove_attachments (ModestWindow *win, gpointer user_ modest_dimming_rule_set_notification (rule, _("FIXME:no attachment selected")); } + /* Messages as attachments could not be removed */ + if (!dimmed && MODEST_IS_MSG_VIEW_WINDOW (win)) { + TnyList *attachments; + TnyIterator *iter; + attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW (win)); + if (attachments) { + iter = tny_list_create_iterator (attachments); + while (!tny_iterator_is_done (iter) && !dimmed) { + TnyMimePart *mime_part = (TnyMimePart *) + tny_iterator_get_current (iter); + if (modest_tny_mime_part_is_msg (mime_part)) + dimmed = TRUE; + g_object_unref (mime_part); + tny_iterator_next (iter); + } + g_object_unref (iter); + g_object_unref (attachments); + } + } + if (!dimmed) { dimmed = _selected_msg_sent_in_progress (win); @@ -1280,7 +1300,6 @@ modest_ui_dimming_rules_on_remove_attachments (ModestWindow *win, gpointer user_ modest_dimming_rule_set_notification (rule, _("mail_ib_attach_not_local")); } - return dimmed; }