From a0b966e2657f775f4745719d5fae7a5fbe2cc9a5 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Wed, 20 Feb 2008 14:49:27 +0000 Subject: [PATCH] * src/modest-ui-dimming-rules.c (_invalid_folder_for_purge): Don't allow removal of attachments from messages in remote folders. Fixes NB#75422 pmo-trunk-r4212 --- src/modest-ui-dimming-rules.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index 57c0970..4281fc1 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -2658,6 +2658,7 @@ _invalid_folder_for_purge (ModestWindow *win, folder = tny_msg_get_folder (msg); g_object_unref (msg); if (folder == NULL) { + result = TRUE; modest_dimming_rule_set_notification (rule, _("mail_ib_unable_to_purge_attachments")); goto frees; } @@ -2684,30 +2685,15 @@ _invalid_folder_for_purge (ModestWindow *win, if (_selected_folder_is_any_of_type (win, types, 2)) { result = TRUE; modest_dimming_rule_set_notification (rule, _("mail_ib_unable_to_purge_editable_msg")); - } else { - result = FALSE; } } else { const gchar *proto_str = tny_account_get_proto (TNY_ACCOUNT (account)); - /* If it's POP then dim */ - if (modest_protocol_info_get_transport_store_protocol (proto_str) == - MODEST_PROTOCOL_STORE_POP) { - TnyList *attachments = NULL; - gint n_selected = 0; + ModestTransportStoreProtocol proto; + proto = modest_protocol_info_get_transport_store_protocol (proto_str); + /* If it's a remote folder then dim */ + if (proto == MODEST_PROTOCOL_STORE_POP || proto == MODEST_PROTOCOL_STORE_IMAP) { result = TRUE; - - /* TODO: This check is here to prevent a gwarning, but this looks like a logic error. - * murrayc */ - if (MODEST_IS_MSG_VIEW_WINDOW (win)) { - attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win)); - n_selected = tny_list_get_length (attachments); - g_object_unref (attachments); - } - - modest_dimming_rule_set_notification (rule, - ngettext ("mail_ib_unable_to_pure_attach_pop_mail_singular", - "mail_ib_unable_to_pure_attach_pop_mail_plural", - n_selected)); + modest_dimming_rule_set_notification (rule, _("mail_ib_unable_to_purge_attachments")); } } -- 1.7.9.5