NULL);
/* Mail Operation Queue */
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (modest_runtime_get_mail_operation_queue ()),
- "queue-changed", G_CALLBACK (on_queue_changed), self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_mail_operation_queue ()),
+ "queue-changed",
+ G_CALLBACK (on_queue_changed), self);
/* Track changes in the device name */
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(modest_runtime_get_conf ()),
- "key_changed", G_CALLBACK (on_configuration_key_changed),
- self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT(modest_runtime_get_conf ()),
+ "key_changed",
+ G_CALLBACK (on_configuration_key_changed),
+ self);
/* Track account changes. We need to refresh the toolbar */
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (modest_runtime_get_account_store ()),
- "account_inserted", G_CALLBACK (on_account_inserted),
- self);
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (modest_runtime_get_account_store ()),
- "account_removed", G_CALLBACK (on_account_removed),
- self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_account_store ()),
+ "account_inserted",
+ G_CALLBACK (on_account_inserted),
+ self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_account_store ()),
+ "account_removed",
+ G_CALLBACK (on_account_removed),
+ self);
/* We need to refresh the send & receive menu to change the bold
* account when the default account changes. */
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
- G_OBJECT (modest_runtime_get_account_mgr ()),
- "default_account_changed",
- G_CALLBACK (on_default_account_changed),
- self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_account_mgr ()),
+ "default_account_changed",
+ G_CALLBACK (on_default_account_changed),
+ self);
/* Account store */
- priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (modest_runtime_get_account_store()),
- "password_requested",
- G_CALLBACK (modest_ui_actions_on_password_requested), self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_account_store()),
+ "password_requested",
+ G_CALLBACK (modest_ui_actions_on_password_requested),
+ self);
}
#if 0
return is_empty;
}
-static void
-on_queue_changed (ModestMailOperationQueue *queue,
- ModestMailOperation *mail_op,
- ModestMailOperationQueueNotification type,
- ModestMainWindow *self)
+
+/**
+ * Gets the toolbar mode needed for each mail operation. It stores in
+ * @mode_changed if the toolbar mode has changed or not
+ */
+static ModestToolBarModes
+get_toolbar_mode_from_mail_operation (ModestMainWindow *self,
+ ModestMailOperation *mail_op,
+ gboolean *mode_changed)
{
- ModestMainWindowPrivate *priv;
- ModestMailOperationTypeOperation op_type;
ModestToolBarModes mode;
- GSList *tmp;
- gboolean mode_changed = FALSE;
+ ModestMainWindowPrivate *priv;
+
+ *mode_changed = FALSE;
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
- g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
/* Get toolbar mode from operation id*/
- op_type = modest_mail_operation_get_type_operation (mail_op);
- switch (op_type) {
+ switch (modest_mail_operation_get_type_operation (mail_op)) {
case MODEST_MAIL_OPERATION_TYPE_RECEIVE:
case MODEST_MAIL_OPERATION_TYPE_OPEN:
mode = TOOLBAR_MODE_TRANSFER;
if (priv->current_toolbar_mode == TOOLBAR_MODE_NORMAL)
- mode_changed = TRUE;
+ *mode_changed = TRUE;
break;
default:
- mode = TOOLBAR_MODE_NORMAL;
-
+ mode = TOOLBAR_MODE_NORMAL;
}
-
-
+ return mode;
+}
+
+static void
+on_mail_operation_started (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestMainWindow *self;
+ ModestMailOperationTypeOperation op_type;
+ ModestMainWindowPrivate *priv;
+ ModestToolBarModes mode;
+ GSList *tmp;
+ gboolean mode_changed = FALSE;
+ TnyAccount *account;
+
+ self = MODEST_MAIN_WINDOW (user_data);
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
+
+ /* Do not show progress for receiving operations if the
+ account is the local account or the MMC one */
+ op_type = modest_mail_operation_get_type_operation (mail_op);
+ account = modest_mail_operation_get_account (mail_op);
+ if (account && op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE) {
+ gboolean is_remote;
+
+ is_remote = !(modest_tny_account_is_virtual_local_folders (account) ||
+ modest_tny_account_is_memory_card_account (account));
+ g_object_unref (account);
+ if (!is_remote)
+ return;
+ }
+
+ /* Get toolbar mode from operation id*/
+ mode = get_toolbar_mode_from_mail_operation (self, mail_op, &mode_changed);
+
/* Add operation observers and change toolbar if neccessary*/
tmp = priv->progress_widgets;
- switch (type) {
- case MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED:
- if (mode == TOOLBAR_MODE_TRANSFER) {
- if (mode_changed) {
- set_toolbar_transfer_mode(self);
- }
- while (tmp) {
- modest_progress_object_add_operation (MODEST_PROGRESS_OBJECT (tmp->data),
- mail_op);
- tmp = g_slist_next (tmp);
- }
+ if (mode == TOOLBAR_MODE_TRANSFER) {
+ if (mode_changed)
+ set_toolbar_transfer_mode(self);
+
+ while (tmp) {
+ modest_progress_object_add_operation (MODEST_PROGRESS_OBJECT (tmp->data),
+ mail_op);
+ tmp = g_slist_next (tmp);
}
- break;
- case MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED:
- /* Change toolbar mode */
- if (mode == TOOLBAR_MODE_TRANSFER) {
- while (tmp) {
- modest_progress_object_remove_operation (MODEST_PROGRESS_OBJECT (tmp->data),
- mail_op);
- tmp = g_slist_next (tmp);
- }
-
- /* If no more operations are being observed, NORMAL mode is enabled again */
- if (observers_empty (self)) {
- set_toolbar_mode (self, TOOLBAR_MODE_NORMAL);
- }
+ }
+}
+
+static void
+on_mail_operation_finished (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestToolBarModes mode;
+ ModestMailOperationTypeOperation op_type;
+ GSList *tmp = NULL;
+ ModestMainWindow *self;
+ gboolean mode_changed;
+ TnyAccount *account;
+ ModestMainWindowPrivate *priv;
+
+ self = MODEST_MAIN_WINDOW (user_data);
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
+
+ /* The mail operation was not added to the progress objects if
+ the account was the local account or the MMC one */
+ op_type = modest_mail_operation_get_type_operation (mail_op);
+ account = modest_mail_operation_get_account (mail_op);
+ if (account && op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE) {
+ gboolean is_remote;
+
+ is_remote = !(modest_tny_account_is_virtual_local_folders (account) ||
+ modest_tny_account_is_memory_card_account (account));
+ g_object_unref (account);
+ if (!is_remote)
+ return;
+ }
+
+ /* Get toolbar mode from operation id*/
+ mode = get_toolbar_mode_from_mail_operation (self, mail_op, &mode_changed);
+
+ /* Change toolbar mode */
+ tmp = priv->progress_widgets;
+ if (mode == TOOLBAR_MODE_TRANSFER) {
+ while (tmp) {
+ modest_progress_object_remove_operation (MODEST_PROGRESS_OBJECT (tmp->data),
+ mail_op);
+ tmp = g_slist_next (tmp);
+ }
+
+ /* If no more operations are being observed, NORMAL mode is enabled again */
+ if (observers_empty (self)) {
+ set_toolbar_mode (self, TOOLBAR_MODE_NORMAL);
}
+ }
+}
- break;
- }
+static void
+on_queue_changed (ModestMailOperationQueue *queue,
+ ModestMailOperation *mail_op,
+ ModestMailOperationQueueNotification type,
+ ModestMainWindow *self)
+{
+ ModestMainWindowPrivate *priv;
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
+
+ if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED) {
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started",
+ G_CALLBACK (on_mail_operation_started),
+ self);
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished",
+ G_CALLBACK (on_mail_operation_finished),
+ self);
+ } else if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED) {
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started");
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished");
+ }
}
static void
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <widgets/modest-combo-box.h>
#include "modest-progress-bar-widget.h"
-#include <string.h>
+#include "modest-tny-account.h"
#include "modest-platform.h"
#include "modest-runtime.h"
gobject_class->finalize = modest_progress_bar_widget_finalize;
g_type_class_add_private (gobject_class, sizeof(ModestProgressBarWidgetPrivate));
-
- /* signal definitions go here, e.g.: */
-/* signals[DATA_CHANGED_SIGNAL] = */
-/* g_signal_new ("data_changed", */
-/* G_TYPE_FROM_CLASS (klass), */
-/* G_SIGNAL_RUN_FIRST, */
-/* G_STRUCT_OFFSET(ModestProgressBarWidgetClass, data_changed), */
-/* NULL, NULL, */
-/* g_cclosure_marshal_VOID__VOID, */
-/* G_TYPE_NONE, 0); */
}
static void
priv->count = 0;
/* Call progress_change handler to initialize progress message */
- modest_progress_bar_widget_set_undetermined_progress (MODEST_PROGRESS_BAR_WIDGET(self), mail_op);
+/* modest_progress_bar_widget_set_undetermined_progress (MODEST_PROGRESS_BAR_WIDGET(self), mail_op); */
}
/* Add operation to obserbable objects list */
/* if ((done == 0 && total == 0) || */
/* (done == 1 && total == 100)) { */
if (!determined) {
- gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (priv->progress_bar), /* Deprecated */
- GTK_PROGRESS_CONTINUOUS);
+/* gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR (priv->progress_bar), /\* Deprecated *\/ */
+/* GTK_PROGRESS_CONTINUOUS); */
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_bar));
-/* printf ("debug: %s:\n undetermined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__, */
-/* (int) priv->progress_bar, */
-/* done, */
-/* total, */
-/* priv->count); */
} else {
gdouble percent = 0;
if (total != 0) /* Avoid division by zero. */
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_bar),
percent);
-
-/* printf ("debug: %s:\n determined progress (%i) changed (%i/%i) : %i\n", __FUNCTION__, */
-/* (int) priv->progress_bar, */
-/* done, */
-/* total, */
-/* priv->count); */
}
/* Set text */
static void modest_mail_operation_queue_finalize (GObject *obj);
static void
-on_progress_changed (ModestMailOperation *mail_op,
- ModestMailOperationState *state,
- gpointer user_data);
+on_operation_finished (ModestMailOperation *mail_op,
+ gpointer user_data);
/* list my signals */
enum {
/* Simply remove from queue, but without emitting a
* QUEUE_CHANGED_SIGNAL because we are in finalize anyway and have
* the lock acquired. */
- g_signal_handlers_disconnect_by_func (mail_op, G_CALLBACK (on_progress_changed), user_data);
+ g_signal_handlers_disconnect_by_func (mail_op, G_CALLBACK (on_operation_finished), user_data);
modest_mail_operation_cancel (mail_op);
g_queue_remove (priv->op_queue, mail_op);
}
static void
-on_progress_changed (ModestMailOperation *mail_op,
- ModestMailOperationState *state,
- gpointer user_data)
+on_operation_finished (ModestMailOperation *mail_op,
+ gpointer user_data)
{
- ModestMailOperationQueue *queue;
-
- if(!state->finished)
- return;
+ ModestMailOperationQueue *queue = MODEST_MAIL_OPERATION_QUEUE (user_data);
/* Remove operation from queue when finished */
- queue = MODEST_MAIL_OPERATION_QUEUE (user_data);
modest_mail_operation_queue_remove (queue, mail_op);
}
g_mutex_lock (priv->queue_lock);
g_queue_push_tail (priv->op_queue, g_object_ref (mail_op));
- modest_mail_operation_set_id (mail_op, priv->op_id++);
g_mutex_unlock (priv->queue_lock);
- /* Get notified when the operation ends to remove it from the queue */
- g_signal_connect (G_OBJECT (mail_op), "progress_changed",
- G_CALLBACK (on_progress_changed), self);
+ /* Get notified when the operation ends to remove it from the
+ queue. We connect it using the *after* because we want to
+ let the other handlers for the finish function happen
+ before this */
+ g_signal_connect_after (G_OBJECT (mail_op),
+ "operation-finished",
+ G_CALLBACK (on_operation_finished),
+ self);
/* Notify observers */
g_signal_emit (self, signals[QUEUE_CHANGED_SIGNAL], 0,
g_mutex_unlock (priv->queue_lock);
g_signal_handlers_disconnect_by_func (G_OBJECT (mail_op),
- G_CALLBACK (on_progress_changed),
+ G_CALLBACK (on_operation_finished),
self);
/* Notify observers */
TnyStatus *status,
gpointer user_data);
+static void modest_mail_operation_notify_start (ModestMailOperation *self);
static void modest_mail_operation_notify_end (ModestMailOperation *self);
enum _ModestMailOperationSignals
{
PROGRESS_CHANGED_SIGNAL,
-
+ OPERATION_STARTED_SIGNAL,
+ OPERATION_FINISHED_SIGNAL,
NUM_SIGNALS
};
typedef struct _ModestMailOperationPrivate ModestMailOperationPrivate;
struct _ModestMailOperationPrivate {
- TnyAccount *account;
- gchar *account_name;
+ TnyAccount *account;
+ gchar *account_name;
guint done;
guint total;
GObject *source;
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
-
+ /**
+ * operation-started
+ *
+ * This signal is issued whenever a mail operation starts, and
+ * starts mean when the tinymail operation is issued. This
+ * means that it could happen that something wrong happens and
+ * the tinymail function is never called. In this situation a
+ * operation-finished will be issued without any
+ * operation-started
+ */
+ signals[OPERATION_STARTED_SIGNAL] =
+ g_signal_new ("operation-started",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ModestMailOperationClass, operation_started),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ /**
+ * operation-started
+ *
+ * This signal is issued whenever a mail operation
+ * finishes. Note that this signal could be issued without any
+ * previous "operation-started" signal, because this last one
+ * is only issued when the tinymail operation is successfully
+ * started
+ */
+ signals[OPERATION_FINISHED_SIGNAL] =
+ g_signal_new ("operation-finished",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ModestMailOperationClass, operation_finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
return retval;
}
-guint
-modest_mail_operation_get_id (ModestMailOperation *self)
-{
- ModestMailOperationPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_MAIL_OPERATION (self), 0);
-
- priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
- return priv->done;
-}
-
-guint
-modest_mail_operation_set_id (ModestMailOperation *self,
- guint id)
-{
- ModestMailOperationPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_MAIL_OPERATION (self), 0);
-
- priv = MODEST_MAIL_OPERATION_GET_PRIVATE (self);
- return priv->done;
-}
-
/*
* Creates an image of the current state of a mail operation, the
* caller must free it
priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
} else {
- /* 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)); */
+ /* Add the msg to the queue */
+ modest_mail_operation_notify_start (self);
modest_tny_send_queue_add (MODEST_TNY_SEND_QUEUE(send_queue),
msg,
&(priv->error));
info->draft_msg = draft_msg;
if (draft_msg)
g_object_ref (draft_msg);
+
+
+ modest_mail_operation_notify_start (self);
modest_mail_operation_create_msg (self, from, to, cc, bcc, subject, plain_body, html_body,
attachments_list, images_list, priority_flags,
modest_mail_operation_send_new_mail_cb, info);
if (edit_window)
g_object_ref (edit_window);
+ modest_mail_operation_notify_start (self);
modest_mail_operation_create_msg (self, from, to, cc, bcc, subject, plain_body, html_body,
attachments_list, images_list, priority_flags,
modest_mail_operation_save_to_drafts_cb, info);
-
}
typedef struct
modest_account_mgr_set_account_busy(mgr, account_name, TRUE);
priv->account_name = g_strdup(account_name);
+ modest_mail_operation_notify_start (self);
thread = g_thread_create (update_account_thread, info, FALSE, NULL);
return TRUE;
if (!priv->error) {
/* Create the folder */
+ modest_mail_operation_notify_start (self);
new_folder = tny_folder_store_create_folder (parent, name, &(priv->error));
CHECK_EXCEPTION (priv, MODEST_MAIL_OPERATION_STATUS_FAILED);
if (!priv->error)
TNY_FOLDER_TYPE_TRASH);
/* TODO: error_handling */
if (trash_folder) {
+ modest_mail_operation_notify_start (self);
modest_mail_operation_xfer_folder (self, folder,
TNY_FOLDER_STORE (trash_folder),
TRUE, NULL, NULL);
} else {
TnyFolderStore *parent = tny_folder_get_folder_store (folder);
+ modest_mail_operation_notify_start (self);
tny_folder_store_remove_folder (parent, folder, &(priv->error));
CHECK_EXCEPTION (priv, MODEST_MAIL_OPERATION_STATUS_FAILED);
helper->user_data = user_data;
/* Move/Copy folder */
+ modest_mail_operation_notify_start (self);
tny_folder_copy_async (folder,
parent,
tny_folder_get_name (folder),
helper->user_data = NULL;
/* Rename. Camel handles folder subscription/unsubscription */
+ modest_mail_operation_notify_start (self);
tny_folder_copy_async (folder, into, name, TRUE,
transfer_folder_cb,
transfer_folder_status_cb,
/* ************************** MSG ACTIONS ************************* */
/* ******************************************************************* */
-void modest_mail_operation_get_msg (ModestMailOperation *self,
- TnyHeader *header,
- GetMsgAsyncUserCallback user_callback,
- gpointer user_data)
+void
+modest_mail_operation_get_msg (ModestMailOperation *self,
+ TnyHeader *header,
+ GetMsgAsyncUserCallback user_callback,
+ gpointer user_data)
{
GetMsgAsyncHelper *helper = NULL;
TnyFolder *folder;
// the user canceled the request meanwhile.
g_object_ref (G_OBJECT (helper->mail_op));
+ modest_mail_operation_notify_start (self);
tny_folder_get_msg_async (folder, header, get_msg_cb, get_msg_status_cb, helper);
g_object_unref (G_OBJECT (folder));
info->headers = g_object_ref (header_list);
info->notify = notify;
+ modest_mail_operation_notify_start (self);
thread = g_thread_create (get_msgs_full_thread, info, FALSE, NULL);
} else {
/* Set status failed and set an error */
tny_header_set_flags (header, TNY_HEADER_FLAG_DELETED);
tny_header_set_flags (header, TNY_HEADER_FLAG_SEEN);
+ modest_mail_operation_notify_start (self);
+
if (TNY_IS_CAMEL_IMAP_FOLDER (folder))
/* tny_folder_sync_async(folder, FALSE, NULL, NULL, NULL); /\* FALSE --> don't expunge *\/ */
tny_folder_sync (folder, FALSE, &(priv->error)); /* FALSE --> don't expunge */
priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
/* remove message from folder */
+ modest_mail_operation_notify_start (self);
+
tny_folder_remove_msgs (folder, headers, &(priv->error));
if (!priv->error) {
if (TNY_IS_CAMEL_IMAP_FOLDER (folder) ||
priv->account = modest_tny_folder_get_account (src_folder);
/* Transfer messages */
+ modest_mail_operation_notify_start (self);
tny_folder_transfer_msgs_async (src_folder,
headers,
folder,
/* Refresh the folder. TODO: tinymail could issue a status
updates before the callback call then this could happen. We
must review the design */
+ modest_mail_operation_notify_start (self);
tny_folder_refresh_async (folder,
on_refresh_folder,
on_refresh_folder_status_update,
helper);
}
+
+static void
+modest_mail_operation_notify_start (ModestMailOperation *self)
+{
+ ModestMailOperationPrivate *priv = NULL;
+
+ g_return_if_fail (self);
+
+ priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
+
+ /* Ensure that all the fields are filled correctly */
+/* g_return_if_fail (priv->account != NULL); */
+/* g_return_if_fail (priv->op_type != MODEST_MAIL_OPERATION_TYPE_UNKNOWN); */
+ g_assert (priv->account != NULL);
+ g_assert (priv->op_type != MODEST_MAIL_OPERATION_TYPE_UNKNOWN);
+
+ /* Notify the observers about the mail operation. We do not
+ wrapp this emission because we assume that this function is
+ always called from within the main lock */
+ g_signal_emit (G_OBJECT (self), signals[OPERATION_STARTED_SIGNAL], 0, NULL);
+}
+
/**
*
* It's used by the mail operation queue to notify the observers
static void
modest_mail_operation_notify_end (ModestMailOperation *self)
{
- ModestMailOperationState *state;
ModestMailOperationPrivate *priv = NULL;
g_return_if_fail (self);
priv->account_name = NULL;
}
- /* Notify the observers about the mail operation end */
- /* We do not wrapp this emission because we assume that this
+ /* Notify the observers about the mail operation end. We do
+ not wrapp this emission because we assume that this
function is always called from within the main lock */
- state = modest_mail_operation_clone_state (self);
- g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
- g_slice_free (ModestMailOperationState, state);
+ g_signal_emit (G_OBJECT (self), signals[OPERATION_FINISHED_SIGNAL], 0, NULL);
+}
+
+TnyAccount *
+modest_mail_operation_get_account (ModestMailOperation *self)
+{
+ ModestMailOperationPrivate *priv = NULL;
+
+ g_return_val_if_fail (self, NULL);
+
+ priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
+
+ return (priv->account) ? g_object_ref (priv->account) : NULL;
}
/* Signals */
void (*progress_changed) (ModestMailOperation *self, ModestMailOperationState *state, gpointer user_data);
+ void (*operation_started) (ModestMailOperation *self, gpointer user_data);
+ void (*operation_finished) (ModestMailOperation *self, gpointer user_data);
};
/* member functions */
RefreshAsyncUserCallback user_callback,
gpointer user_data);
-guint modest_mail_operation_get_id (ModestMailOperation *self);
-
-guint modest_mail_operation_set_id (ModestMailOperation *self,
- guint id);
+TnyAccount *modest_mail_operation_get_account (ModestMailOperation *self);
G_END_DECLS