* Changed the nofify_end function, it does not need the locking because the signal handlers are executed into the main lock
pmo-trunk-r2547
TnyStatus *status,
gpointer user_data);
TnyStatus *status,
gpointer user_data);
-static void modest_mail_operation_notify_end (ModestMailOperation *self,
- gboolean need_lock);
+static void modest_mail_operation_notify_end (ModestMailOperation *self);
static gboolean did_a_cancel = FALSE;
static gboolean did_a_cancel = FALSE;
/* This emits progress-changed on which the mail operation queue is
* listening, so the mail operation is correctly removed from the
* queue without further explicit calls. */
/* This emits progress-changed on which the mail operation queue is
* listening, so the mail operation is correctly removed from the
* queue without further explicit calls. */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
/* TODO: do this in the handler of the "msg-sent"
signal.Notify about operation end */
/* TODO: do this in the handler of the "msg-sent"
signal.Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
if (folder)
g_object_unref (G_OBJECT(folder));
if (folder)
g_object_unref (G_OBJECT(folder));
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
gchar *account_name;
UpdateAccountCallback callback;
gpointer user_data;
gchar *account_name;
UpdateAccountCallback callback;
gpointer user_data;
} UpdateAccountInfo;
/***** I N T E R N A L F O L D E R O B S E R V E R *****/
} UpdateAccountInfo;
/***** I N T E R N A L F O L D E R O B S E R V E R *****/
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(mail_op);
/* Do not need to block, the notify end will do it for us */
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(mail_op);
/* Do not need to block, the notify end will do it for us */
- modest_mail_operation_notify_end (mail_op, TRUE);
+ modest_mail_operation_notify_end (mail_op);
g_object_unref (mail_op);
return FALSE;
g_object_unref (mail_op);
return FALSE;
+static gboolean
+idle_update_account_cb (gpointer data)
+{
+ UpdateAccountInfo *idle_info;
+
+ idle_info = (UpdateAccountInfo *) data;
+
+ gdk_threads_enter ();
+ idle_info->callback (idle_info->mail_op,
+ idle_info->new_headers,
+ idle_info->user_data);
+ gdk_threads_leave ();
+
+ /* Frees */
+ g_object_unref (idle_info->mail_op);
+ g_free (idle_info);
+
+ return FALSE;
+}
+
+
static gpointer
update_account_thread (gpointer thr_user_data)
{
static gpointer
update_account_thread (gpointer thr_user_data)
{
+
+ if (info->callback) {
+ UpdateAccountInfo *idle_info;
+
+ /* This thread is not in the main lock */
+ idle_info = g_malloc0 (sizeof (UpdateAccountInfo));
+ idle_info->mail_op = g_object_ref (info->mail_op);
+ idle_info->new_headers = (new_headers) ? new_headers->len : 0;
+ idle_info->callback = info->callback;
+ g_idle_add (idle_update_account_cb, idle_info);
+ }
+
/* 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 (idle_notify_update_account_queue, g_object_ref (info->mail_op));
/* 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 (idle_notify_update_account_queue, g_object_ref (info->mail_op));
- if (info->callback) {
- /* This thread is not in the main lock */
- gdk_threads_enter ();
- info->callback (info->mail_op,
- (new_headers) ? new_headers->len : 0,
- info->user_data);
- gdk_threads_leave ();
- }
-
/* Frees */
g_object_unref (query);
g_object_unref (all_folders);
/* Frees */
g_object_unref (query);
g_object_unref (all_folders);
priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
if (callback)
callback (self, 0, user_data);
priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
if (callback)
callback (self, 0, user_data);
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
}
/* Notify about operation end */
}
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
end:
/* Notify about operation end */
end:
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
g_object_unref (into);
/* Notify about operation end */
g_object_unref (into);
/* Notify about operation end */
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
_("mail_in_ui_folder_move_target_error"));
/* Notify the queue */
_("mail_in_ui_folder_move_target_error"));
/* Notify the queue */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
} else if (TNY_IS_FOLDER (parent) &&
(parent_rules & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE)) {
/* Set status failed and set an error */
} else if (TNY_IS_FOLDER (parent) &&
(parent_rules & MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE)) {
/* Set status failed and set an error */
_("FIXME: parent folder does not accept new folders"));
/* Notify the queue */
_("FIXME: parent folder does not accept new folders"));
/* Notify the queue */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
} else {
/* Pick references for async calls */
g_object_ref (folder);
} else {
/* Pick references for async calls */
g_object_ref (folder);
_("FIXME: unable to rename"));
/* Notify about operation end */
_("FIXME: unable to rename"));
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
} else if (!strcmp (name, " ") || strchr (name, '/')) {
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 about operation end */
} else if (!strcmp (name, " ") || strchr (name, '/')) {
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 about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
} else {
TnyFolderStore *into;
} else {
TnyFolderStore *into;
_("Error trying to get a message. No folder found for header"));
/* Notify the queue */
_("Error trying to get a message. No folder found for header"));
/* Notify the queue */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
/* Notify about operation end */
if(priv->status != MODEST_MAIL_OPERATION_STATUS_CANCELED)
/* Notify about operation end */
if(priv->status != MODEST_MAIL_OPERATION_STATUS_CANCELED)
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
g_object_unref (G_OBJECT (self));
}
g_object_unref (G_OBJECT (self));
}
MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT,
_("emev_ni_ui_imap_msg_size_exceed_error"));
/* Remove from queue and free resources */
MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT,
_("emev_ni_ui_imap_msg_size_exceed_error"));
/* Remove from queue and free resources */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
if (notify)
notify (user_data);
}
if (notify)
notify (user_data);
}
g_object_unref (G_OBJECT (folder));
/* Notify about operation end */
g_object_unref (G_OBJECT (folder));
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
}
/* Notify about operation end */
}
/* Notify about operation end */
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
/* If user defined callback function was defined, call it */
if (helper->user_callback) {
/* If user defined callback function was defined, call it */
if (helper->user_callback) {
MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
_("ckct_ib_unable_to_paste_here"));
/* Notify the queue */
MODEST_MAIL_OPERATION_ERROR_FOLDER_RULES,
_("ckct_ib_unable_to_paste_here"));
/* Notify the queue */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
_("mcen_ib_unable_to_copy_samefolder"));
/* Notify the queue */
_("mcen_ib_unable_to_copy_samefolder"));
/* Notify the queue */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
/* Free */
g_object_unref (src_folder);
/* Free */
g_object_unref (src_folder);
g_object_unref (folder);
/* Notify about operation end */
g_object_unref (folder);
/* Notify about operation end */
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
* callback).
*/
static void
* callback).
*/
static void
-modest_mail_operation_notify_end (ModestMailOperation *self,
- gboolean need_lock)
+modest_mail_operation_notify_end (ModestMailOperation *self)
{
ModestMailOperationState *state;
ModestMailOperationPrivate *priv = NULL;
{
ModestMailOperationState *state;
ModestMailOperationPrivate *priv = NULL;
/* Notify the observers about the mail opertation end */
state = modest_mail_operation_clone_state (self);
/* Notify the observers about the mail opertation end */
state = modest_mail_operation_clone_state (self);
- if (need_lock)
- gdk_threads_enter ();
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
- if (need_lock)
- gdk_threads_leave ();
g_slice_free (ModestMailOperationState, state);
}
g_slice_free (ModestMailOperationState, state);
}
if (error->message != NULL)
g_printerr ("modest: %s\n", error->message);
else
if (error->message != NULL)
g_printerr ("modest: %s\n", error->message);
else
- g_printerr ("modest: unkonw error on sedn&receive operation");
+ g_printerr ("modest: unkonw error on send&receive operation");
- if (modest_mail_operation_get_id (mail_op) == MODEST_MAIL_OPERATION_TYPE_RECEIVE)
- modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
- _CS("sfil_ib_unable_to_receive"));
- else
- modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
- _CS("sfil_ib_unable_to_send"));
- g_object_unref (win);
+/* if (modest_mail_operation_get_id (mail_op) == MODEST_MAIL_OPERATION_TYPE_RECEIVE) */
+/* modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL, */
+/* _CS("sfil_ib_unable_to_receive")); */
+/* else */
+/* modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL, */
+/* _CS("sfil_ib_unable_to_send")); */
+ g_object_unref (win);