/* Delete folder or move to trash */
if (remove_to_trash) {
TnyFolder *trash_folder = NULL;
-/* TnyFolder *trash_folder, *new_folder; */
trash_folder = modest_tny_account_get_special_folder (account,
TNY_FOLDER_TYPE_TRASH);
/* TODO: error_handling */
modest_mail_operation_xfer_folder (self, folder,
TNY_FOLDER_STORE (trash_folder), TRUE);
-/* new_folder = modest_mail_operation_xfer_folder (self, folder, */
-/* TNY_FOLDER_STORE (trash_folder), TRUE); */
-/* g_object_unref (G_OBJECT (new_folder)); */
} else {
TnyFolderStore *parent = tny_folder_get_folder_store (folder);
modest_mail_operation_notify_end (self);
}
-TnyFolder *
+void
modest_mail_operation_xfer_folder (ModestMailOperation *self,
TnyFolder *folder,
TnyFolderStore *parent,
gboolean delete_original)
{
- ModestMailOperationPrivate *priv;
- TnyFolder *new_folder = NULL;
- ModestTnyFolderRules rules;
-
- g_return_val_if_fail (MODEST_IS_MAIL_OPERATION (self), NULL);
- g_return_val_if_fail (TNY_IS_FOLDER_STORE (parent), NULL);
- g_return_val_if_fail (TNY_IS_FOLDER (folder), NULL);
-
- priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
-
- /* The moveable restriction is applied also to copy operation */
- rules = modest_tny_folder_get_rules (TNY_FOLDER (parent));
- if (rules & MODEST_FOLDER_RULES_FOLDER_NON_MOVEABLE) {
- g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
- MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
- _("FIXME: unable to rename"));
- } else {
- /* Move/Copy folder */
- new_folder = tny_folder_copy (folder,
- parent,
- tny_folder_get_name (folder),
- delete_original,
- &(priv->error));
- }
-
- /* Notify about operation end */
- modest_mail_operation_notify_end (self);
-
- return new_folder;
-}
-
-void
-modest_mail_operation_xfer_folder_async (ModestMailOperation *self,
- TnyFolder *folder,
- TnyFolderStore *parent,
- gboolean delete_original)
-{
XFerFolderAsyncHelper *helper = NULL;
ModestMailOperationPrivate *priv = NULL;
ModestTnyFolderRules rules;
* If @delete_original is TRUE this function moves the original
* folder, if it is FALSE the it just copies it
*
- * Returns: the newly transfered folder
**/
-TnyFolder* modest_mail_operation_xfer_folder (ModestMailOperation *self,
+void modest_mail_operation_xfer_folder (ModestMailOperation *self,
TnyFolder *folder,
TnyFolderStore *parent,
gboolean delete_original);
-
-
-/**
- * modest_mail_operation_xfer_folder:
- * @self: a #ModestMailOperation
- * @folder: a #TnyFolder
- * @parent: the new parent of the folder as #TnyFolderStore
- * @delete_original: wheter or not delete the original folder
- *
- * Sets the given @folder as child of a provided #TnyFolderStore. This
- * operation also transfers all the messages contained in the folder
- * and all of his children folders with their messages as well. This
- * operation is synchronous, so the #ModestMailOperation should not be
- * added to any #ModestMailOperationQueue.
- *
- * If @delete_original is TRUE this function moves the original
- * folder, if it is FALSE the it just copies it
- *
- **/
-void modest_mail_operation_xfer_folder_async (ModestMailOperation *self,
- TnyFolder *folder,
- TnyFolderStore *parent,
- gboolean delete_original);
/* Functions that performs msg operations */
/**
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
- modest_mail_operation_xfer_folder_async (mail_op,
- TNY_FOLDER (src_folder),
- folder_store,
- TRUE);
+ modest_mail_operation_xfer_folder (mail_op,
+ TNY_FOLDER (src_folder),
+ folder_store,
+ TRUE);
g_object_unref (G_OBJECT (mail_op));
}
g_signal_connect (G_OBJECT (mail_op), "progress-changed",
G_CALLBACK (on_progress_changed), helper);
- modest_mail_operation_xfer_folder_async (mail_op,
- folder,
- parent_folder,
- helper->delete_source);
+ modest_mail_operation_xfer_folder (mail_op,
+ folder,
+ parent_folder,
+ helper->delete_source);
/* Frees */
g_object_unref (G_OBJECT (parent_folder));
won't longer exist. We can not wait for the end of
the operation, because the operation won't start if
the folder is in use */
- /* TODO: helper was not instantiated before here: */
- if (helper && helper->delete_source && source_widget == widget)
+ if (source_widget == widget)
g_signal_emit (G_OBJECT (widget),
signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0, NULL, TRUE);
}