* src/maemo/modest-main-window.c:
[modest] / src / modest-mail-operation.c
index d15b510..136aab3 100644 (file)
@@ -305,6 +305,7 @@ modest_mail_operation_new_with_error_handling (ModestMailOperationTypeOperation
        
        g_return_val_if_fail (error_handler != NULL, obj);
        priv->error_checking = error_handler;
+       priv->error_checking_user_data = user_data;
 
        return obj;
 }
@@ -562,7 +563,10 @@ modest_mail_operation_send_mail (ModestMailOperation *self,
                /* TODO: connect to the msg-sent in order to know when
                   the mail operation is finished */
 
-               tny_send_queue_add (send_queue, msg, &(priv->error));
+/*             tny_send_queue_add (send_queue, msg, &(priv->error)); */
+               modest_tny_send_queue_add (MODEST_TNY_SEND_QUEUE(send_queue), 
+                                          msg, 
+                                          &(priv->error));
 
                /* TODO: we're setting always success, do the check in
                   the handler */
@@ -1306,6 +1310,7 @@ update_account_thread (gpointer thr_user_data)
                        if (G_UNLIKELY (!first_time))
                                tny_folder_poke_status (TNY_FOLDER (folder));
                }
+
                tny_folder_remove_observer (TNY_FOLDER (folder), TNY_FOLDER_OBSERVER (observer));
                g_object_unref (observer);
                observer = NULL;                        
@@ -1558,28 +1563,19 @@ modest_mail_operation_create_folder (ModestMailOperation *self,
        ModestMailOperationPrivate *priv;
        TnyFolder *new_folder = NULL;
 
-       TnyList *list = tny_simple_list_new ();
-       TnyFolderStoreQuery *query = tny_folder_store_query_new ();
-
        g_return_val_if_fail (TNY_IS_FOLDER_STORE (parent), NULL);
        g_return_val_if_fail (name, NULL);
        
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
 
        /* Check for already existing folder */
-       tny_folder_store_query_add_item (query, name, TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_NAME);
-       tny_folder_store_get_folders (parent, list, query, NULL);
-       g_object_unref (G_OBJECT (query));
-
-       if (tny_list_get_length (list) > 0) {
+       if (modest_tny_folder_has_subfolder_with_name (parent, name)) {
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_EXISTS,
                             _CS("ckdg_ib_folder_already_exists"));
        }
 
-       g_object_unref (G_OBJECT (list));
-
        /* Check parent */
        if (TNY_IS_FOLDER (parent)) {
                /* Check folder rules */
@@ -1841,6 +1837,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
        ModestTnyFolderRules parent_rules = 0, rules; 
        XFerMsgAsyncHelper *helper = NULL;
        const gchar *folder_name = NULL;
+       const gchar *error_msg;
 
        g_return_if_fail (MODEST_IS_MAIL_OPERATION (self));
        g_return_if_fail (TNY_IS_FOLDER (folder));
@@ -1849,6 +1846,9 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
        priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
        folder_name = tny_folder_get_name (folder);
 
+       /* Set the error msg */
+       error_msg = _("mail_in_ui_folder_move_target_error");
+
        /* Get account and set it into mail_operation */
        priv->account = modest_tny_folder_get_account (TNY_FOLDER(folder));
        priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
@@ -1867,7 +1867,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
-                            _("mail_in_ui_folder_move_target_error"));
+                            error_msg);
 
                /* Notify the queue */
                modest_mail_operation_notify_end (self);
@@ -1879,7 +1879,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
-                            _("FIXME: parent folder does not accept new folders"));
+                            error_msg);
 
                /* Notify the queue */
                modest_mail_operation_notify_end (self);
@@ -1891,7 +1891,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
-                            _("mail_in_ui_folder_copy_target_error"));
+                            error_msg);
 
                /* Notify the queue */
                modest_mail_operation_notify_end (self);
@@ -1905,7 +1905,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
-                            _("mail_in_ui_folder_move_target_error"));
+                            error_msg);
 
                /* Notify the queue */
                modest_mail_operation_notify_end (self);
@@ -1918,7 +1918,7 @@ modest_mail_operation_xfer_folder (ModestMailOperation *self,
                priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
                g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
                             MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
-                            _("mail_in_ui_folder_move_target_error"));
+                            error_msg);
 
                /* Notify the queue */
                modest_mail_operation_notify_end (self);
@@ -2766,10 +2766,7 @@ on_refresh_folder (TnyFolder   *folder,
 
                /* This is not a GDK lock because we are a Tinymail callback and
                 * Tinymail already acquires the Gdk lock */
-
-               /* no gdk_threads_enter (), CHECKED */
                helper->user_callback (self, folder, helper->user_data);
-               /* no gdk_threads_leave (), CHECKED */
        }
 
  out:
@@ -2808,13 +2805,8 @@ on_refresh_folder_status_update (GObject *obj,
 
        /* This is not a GDK lock because we are a Tinymail callback and
         * Tinymail already acquires the Gdk lock */
-
-       /* no gdk_threads_enter (), CHECKED */
-
        g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
 
-       /* no gdk_threads_leave (), CHECKED */
-
        g_slice_free (ModestMailOperationState, state);
 }