* Removed xfer_folder_async, all the xfer_folder operations are now async
authorSergio Villar Senin <svillar@igalia.com>
Mon, 21 May 2007 14:36:27 +0000 (14:36 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 21 May 2007 14:36:27 +0000 (14:36 +0000)
* Fixed a logical error when drag&drop

pmo-trunk-r1941

src/modest-mail-operation.c
src/modest-mail-operation.h
src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index 9fee69a..d7eb622 100644 (file)
@@ -816,15 +816,11 @@ modest_mail_operation_remove_folder (ModestMailOperation *self,
        /* 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);
 
@@ -947,49 +943,12 @@ transfer_folder_cb (TnyFolder *folder, TnyFolderStore *into, gboolean cancelled,
        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;
index bd7ca2c..1f046b3 100644 (file)
@@ -359,36 +359,12 @@ void          modest_mail_operation_rename_folder  (ModestMailOperation *self,
  * 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 */
 
 /**
index 3445e47..602e512 100644 (file)
@@ -2440,10 +2440,10 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action,
                        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));
                        
                }
index d7a872d..58b98bd 100644 (file)
@@ -1054,10 +1054,10 @@ drag_and_drop_from_folder_view (GtkTreeModel     *source_model,
        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));
@@ -1102,8 +1102,7 @@ on_drag_data_received (GtkWidget *widget,
                   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);
        }