TnyStatus *status,
gpointer user_data);
+static void modest_mail_operation_notify_end (ModestMailOperation *self);
enum _ModestMailOperationSignals
{
}
}
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
void
goto cleanup;
}
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ modest_mail_operation_notify_end (self);
/* Free */
cleanup:
{
ModestMailOperation *mail_op = MODEST_MAIL_OPERATION (data);
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
- mail_op);
+ modest_mail_operation_notify_end (mail_op);
g_object_unref (mail_op);
return FALSE;
}
out:
- /* Notify the queue. Note that the info could be freed before
- this idle happens, but the mail operation will be still
- alive */
+ /* Notify about operation end. Note that the info could be
+ freed before this idle happens, but the mail operation will
+ be still alive */
g_idle_add (notify_update_account_queue, info->mail_op);
/* Frees */
g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
"cannot get tny store account for %s\n", account_name);
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
- self);
+ modest_mail_operation_notify_end (self);
return FALSE;
}
g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
"cannot get tny transport account for %s\n", account_name);
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
- self);
+ modest_mail_operation_notify_end (self);
return FALSE;
}
/* Set new status */
priv->status = MODEST_MAIL_OPERATION_STATUS_CANCELED;
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
return TRUE;
}
CHECK_EXCEPTION (priv, MODEST_MAIL_OPERATION_STATUS_FAILED);
}
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
return new_folder;
}
g_object_unref (G_OBJECT (account));
end:
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
void
}
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
static void
transfer_folder_status_cb (GObject *obj,
- TnyStatus *status,
+ TnyStatus *status,
gpointer user_data)
{
XFerMsgAsyncHelper *helper = NULL;
g_return_if_fail (status->code == TNY_FOLDER_STATUS_CODE_COPY_FOLDER);
helper = (XFerMsgAsyncHelper *) user_data;
- g_return_if_fail (helper != NULL);
-
- /* Temporary FIX: useful when tinymail send us status
- information *after* calling the function callback */
- if (!MODEST_IS_MAIL_OPERATION (helper->mail_op))
- return;
+ g_return_if_fail (helper != NULL);
self = helper->mail_op;
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
priv->done = status->position;
priv->total = status->of_total;
-
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, NULL);
}
if (*err) {
priv->error = g_error_copy (*err);
priv->done = 0;
- priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
+ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
} else if (cancelled) {
priv->status = MODEST_MAIL_OPERATION_STATUS_CANCELED;
g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
g_slice_free (XFerFolderAsyncHelper, helper);
g_object_unref (folder);
g_object_unref (into);
- if (new_folder != NULL)
+ if (new_folder != NULL)
g_object_unref (new_folder);
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
TnyFolder *
&(priv->error));
}
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
return new_folder;
}
/* 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) {
- priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
_("FIXME: unable to rename"));
/* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ modest_mail_operation_notify_end (self);
} else {
helper = g_slice_new0 (XFerFolderAsyncHelper);
helper->mail_op = self;
if (helper->pending_ops == 0) {
g_slice_free (GetMsgAsyncHelper, helper);
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
}
tny_iterator_next (iter);
}
- /* Notify the queue */
+ /* Notify about operation end */
g_idle_add (notify_update_account_queue, info->mail_op);
/* Free thread resources. Will be called after all previous idles */
MODEST_MAIL_OPERATION_ERROR_BAD_PARAMETER,
_("emev_ni_ui_imap_msg_sizelimit_error"));
/* Remove from queue and free resources */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ modest_mail_operation_notify_end (self);
if (notify)
notify (user_data);
}
/* Free */
g_object_unref (G_OBJECT (folder));
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
static void
helper = (XFerMsgAsyncHelper *) user_data;
g_return_if_fail (helper != NULL);
- /* Temporary FIX: useful when tinymail send us status
- information *after* calling the function callback */
- if (!MODEST_IS_MAIL_OPERATION (helper->mail_op))
- return;
-
self = helper->mail_op;
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
g_slice_free (XFerMsgAsyncHelper, helper);
g_object_unref (folder);
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
void
/* Free */
g_object_unref (folder);
- /* Notify the queue */
- modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
}
static void
self);
}
-void
-_modest_mail_operation_notify_end (ModestMailOperation *self)
+/**
+ *
+ * It's used by the mail operation queue to notify the observers
+ * attached to that signal that the operation finished. We need to use
+ * that because tinymail does not give us the progress of a given
+ * operation when it finishes (it directly calls the operation
+ * callback).
+ */
+static void
+modest_mail_operation_notify_end (ModestMailOperation *self)
{
+ /* Notify the observers about the mail opertation end */
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, NULL);
+
+ /* Notify the queue */
+ modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (), self);
}