- header_list = get_selected_headers (win);
-
- if (header_list) {
- iter = tny_list_create_iterator (header_list);
- do {
- TnyHeader *header;
- ModestMailOperation *mail_op;
-
- header = TNY_HEADER (tny_iterator_get_current (iter));
- /* TODO: thick grain mail operation involving
- a list of objects. Composite pattern ??? */
- /* TODO: add confirmation dialog */
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_DELETE);
- modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
- mail_op);
-
- /* Always delete. TODO: Move to trash still not supported */
- modest_mail_operation_remove_msg (mail_op, header, FALSE);
-
- /* Frees */
- g_object_unref (G_OBJECT (mail_op));
- g_object_unref (G_OBJECT (header));
-
- tny_iterator_next (iter);
-
- } while (!tny_iterator_is_done (iter));
-
- /* Free iter */
- g_object_unref (G_OBJECT (iter));
- }
+ /* Remove each header */
+ do_headers_action (win, headers_action_delete, NULL);