- /* Check account */
- if (!modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (account))) {
- 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) {
- GList *attachments;
- gint n_selected;
- result = TRUE;
- attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
- n_selected = g_list_length (attachments);
- g_list_free (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));
- }
+ } else {
+ g_return_val_if_reached (FALSE);
+ }
+ account = modest_tny_folder_get_account (folder);
+ if (account == NULL) goto frees;
+
+ /* Check account */
+ if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (account))) {
+ TnyFolderType types[2];
+ types[0] = TNY_FOLDER_TYPE_DRAFTS;
+ types[1] = TNY_FOLDER_TYPE_OUTBOX;
+
+ 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 {
+ /* We're currently disabling purge in any local store */
+ result = TRUE;
+ modest_dimming_rule_set_notification (rule, _("mail_ib_unable_to_purge_attachments"));
+ }
+ } 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) {
+ GList *attachments;
+ gint n_selected;
+ result = TRUE;
+ attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
+ n_selected = g_list_length (attachments);
+ g_list_free (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));