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;
/* 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);
return TRUE;
}
/* 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);
}
void
if (folder)
g_object_unref (G_OBJECT(folder));
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
}
typedef struct
gchar *account_name;
UpdateAccountCallback callback;
gpointer user_data;
+ gint new_headers;
} 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 */
- modest_mail_operation_notify_end (mail_op, TRUE);
+ modest_mail_operation_notify_end (mail_op);
g_object_unref (mail_op);
return FALSE;
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)
{
}
out:
+
+ 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));
- 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);
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);
return FALSE;
}
}
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
return new_folder;
}
end:
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
}
static void
g_object_unref (into);
/* Notify about operation end */
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
}
void
_("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 */
_("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);
_("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 */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
} else {
TnyFolderStore *into;
_("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)
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (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_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
if (notify)
notify (user_data);
}
g_object_unref (G_OBJECT (folder));
/* Notify about operation end */
- modest_mail_operation_notify_end (self, FALSE);
+ modest_mail_operation_notify_end (self);
}
static void
}
/* 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) {
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);
return;
}
_("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);
g_object_unref (folder);
/* Notify about operation end */
- modest_mail_operation_notify_end (self, TRUE);
+ modest_mail_operation_notify_end (self);
}
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;
/* 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);
- if (need_lock)
- gdk_threads_leave ();
g_slice_free (ModestMailOperationState, state);
}