}
}
-
-static void
-headers_action_delete (TnyHeader *header,
- ModestWindow *win,
- gpointer user_data)
+/** A convenience method, because deleting a message is
+ * otherwise complicated, and it's best to change it in one place
+ * when we change it.
+ */
+void modest_do_message_delete (TnyHeader *header, ModestWindow *win)
{
ModestMailOperation *mail_op = NULL;
-
- mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_DELETE, G_OBJECT(win));
+ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_DELETE,
+ win ? G_OBJECT(win) : NULL);
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);
g_object_unref (G_OBJECT (mail_op));
+}
- /* refilter treemodel to hide marked-as-deleted rows */
+static void
+headers_action_delete (TnyHeader *header,
+ ModestWindow *win,
+ gpointer user_data)
+{
+ modest_do_message_delete (header, win);
+
+/* refilter treemodel to hide marked-as-deleted rows */
/* if (MODEST_IS_HEADER_VIEW (user_data)) */
/* modest_header_view_refilter (MODEST_HEADER_VIEW (user_data)); */
}
rf_helper->reply_forward_type = reply_forward_type;
rf_helper->action = action;
rf_helper->account_name = g_strdup (modest_window_get_active_account (win));
+
if ((win != NULL) && (MODEST_IS_WINDOW (win)))
rf_helper->parent_window = GTK_WIDGET (win);
if (!rf_helper->account_name)
gpointer user_data)
{
ModestMainWindow *window = MODEST_MAIN_WINDOW (user_data);
+ const GError *error = modest_mail_operation_get_error (mail_op);
- /* TODO: Note that folder creation might go wrong due to other
- * failures such as when the parent folder is non-writable. We can
- * query a GError* with modest_mail_operation_get_error(), but the
- * the error code (from tinymail) does not give us a clue about what
- * has gone wrong. We might use the error->message but it might come
- * from camel and not be suitable to show to the user directly. */
- modest_platform_information_banner (GTK_WIDGET (window), NULL,
- _CS("ckdg_ib_folder_already_exists"));
-
-/* modest_platform_information_banner (GTK_WIDGET (window), NULL,
- modest_mail_operation_get_error (mail_op)->message);*/
+ if(error)
+ {
+ modest_platform_information_banner (GTK_WIDGET (window), NULL,
+ modest_mail_operation_get_error (mail_op)->message);
+ }
}
gint pending_purges = 0;
gboolean some_purged = FALSE;
ModestWindow *win = MODEST_WINDOW (user_data);
+ ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
/* If there was any error */
- if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg))
+ if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
+ modest_window_mgr_unregister_header (mgr, header);
return;
+ }
/* Once the message has been retrieved for purging, we check if
* it's all ok for purging */
g_object_unref (part);
tny_iterator_next (iter);
}
+ modest_window_mgr_unregister_header (mgr, header);
g_object_unref (iter);
g_object_unref (parts);