if (auto_update)
/* Do send receive */
- modest_ui_actions_do_send_receive_all (main_win, FALSE, FALSE);
+ modest_ui_actions_do_send_receive_all (main_win, FALSE, FALSE, FALSE);
else
/* Disable auto update */
modest_platform_set_update_interval (0);
/* If account_name == NULL, we must update all (option All) */
if (!account_name)
- modest_ui_actions_do_send_receive_all (win, TRUE, TRUE);
+ modest_ui_actions_do_send_receive_all (win, TRUE, TRUE, TRUE);
else
- modest_ui_actions_do_send_receive (account_name, TRUE, TRUE, win);
+ modest_ui_actions_do_send_receive (account_name, TRUE, TRUE, TRUE, win);
}
modest_mail_operation_notify_start (self);
tny_send_queue_add_async (send_queue, msg, NULL, NULL, NULL);
+ modest_tny_send_queue_set_requested_send_receive (MODEST_TNY_SEND_QUEUE (send_queue), FALSE);
priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS;
modest_mail_operation_notify_end (self);
gboolean poke_all;
TnyFolderObserver *inbox_observer;
RetrieveAllCallback retrieve_all_cb;
+ gboolean interactive;
} UpdateAccountInfo;
/* Try to send */
tny_camel_send_queue_flush (TNY_CAMEL_SEND_QUEUE (send_queue));
+ modest_tny_send_queue_set_requested_send_receive (MODEST_TNY_SEND_QUEUE (send_queue),
+ info->interactive);
}
}
modest_mail_operation_update_account (ModestMailOperation *self,
const gchar *account_name,
gboolean poke_all,
+ gboolean interactive,
RetrieveAllCallback retrieve_all_cb,
UpdateAccountCallback callback,
gpointer user_data)
info->folders = tny_simple_list_new ();
info->mail_op = g_object_ref (self);
info->poke_all = poke_all;
+ info->interactive = interactive;
info->account_name = g_strdup (account_name);
info->callback = callback;
info->user_data = user_data;
* @self: a #ModestMailOperation
* @account_name: the id of a Modest account
* @poke_all: if TRUE it will also do a poke_status over all folders of the account
+ * @interactive: if TRUE the update account was scheduled by an interactive send receive
*
* Asynchronously refreshes the root folders of the given store
* account. The caller should add the #ModestMailOperation to a
void modest_mail_operation_update_account (ModestMailOperation *self,
const gchar *account_name,
gboolean poke_all,
+ gboolean interactive,
RetrieveAllCallback retrieve_all_cb,
UpdateAccountCallback callback,
gpointer user_data);
/* Perform a send receive */
account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE);
- modest_ui_actions_do_send_receive (account_name, FALSE, FALSE, main_window);
+ modest_ui_actions_do_send_receive (account_name, FALSE, FALSE, FALSE, main_window);
}
}
/* Special folders */
TnyFolder *outbox;
TnyFolder *sentbox;
+
+ /* last was send receive operation?*/
+ gboolean requested_send_receive;
};
#define MODEST_TNY_SEND_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->sentbox = modest_tny_account_get_special_folder (TNY_ACCOUNT(account),
TNY_FOLDER_TYPE_SENT);
+ priv->requested_send_receive = FALSE;
+
headers = tny_simple_list_new ();
tny_folder_get_headers (priv->outbox, headers, TRUE, NULL);
g_object_unref (iter);
g_object_unref (G_OBJECT (headers));
}
+
+gboolean
+modest_tny_send_queue_get_requested_send_receive (ModestTnySendQueue *self)
+{
+ ModestTnySendQueuePrivate *priv;
+
+ g_return_val_if_fail (MODEST_IS_TNY_SEND_QUEUE (self), FALSE);
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+
+ return priv->requested_send_receive;
+}
+
+void
+modest_tny_send_queue_set_requested_send_receive (ModestTnySendQueue *self, gboolean requested_send_receive)
+{
+ ModestTnySendQueuePrivate *priv;
+
+ g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE (self));
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+
+ priv->requested_send_receive = requested_send_receive;
+}
*/
void modest_tny_send_queue_wakeup (ModestTnySendQueue *self);
+/**
+ * modest_tny_send_queue_get_requested_send_receive:
+ * @self: a #ModestTnySendQueue
+ *
+ * gets if the last request to send queue was an interactive send
+ * receive or not.
+ *
+ * Returns: %TRUE if last request was an interactive send receive,
+ * %FALSE otherwise.
+ */
+gboolean modest_tny_send_queue_get_requested_send_receive (ModestTnySendQueue *self);
+
+/**
+ * modest_tny_send_queue_set_requested_send_receive:
+ * @self: a #ModestTnySendQueue
+ * @requested_send_receive: mode.
+ *
+ * this should be called on each call to process the queue, to distinguish if the
+ * action was an interactive send receive.
+ */
+void modest_tny_send_queue_set_requested_send_receive (ModestTnySendQueue *self, gboolean requested_send_receive);
+
G_END_DECLS
ModestWindow *win;
gchar *account_name;
gboolean poke_status;
+ gboolean interactive;
} SendReceiveInfo;
static void
/* Send & receive. */
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
- modest_mail_operation_update_account (mail_op, info->account_name, info->poke_status,
+ modest_mail_operation_update_account (mail_op, info->account_name, info->poke_status, info->interactive,
(info->win) ? retrieve_all_messages_cb : NULL,
new_messages_arrived, info->win);
g_object_unref (G_OBJECT (mail_op));
modest_ui_actions_do_send_receive (const gchar *account_name,
gboolean force_connection,
gboolean poke_status,
+ gboolean interactive,
ModestWindow *win)
{
gchar *acc_name = NULL;
info->account_name = acc_name;
info->win = (win) ? g_object_ref (win) : NULL;
info->poke_status = poke_status;
+ info->interactive = interactive;
info->account = modest_tny_account_store_get_server_account (acc_store, acc_name,
TNY_ACCOUNT_TYPE_STORE);
void
modest_ui_actions_do_send_receive_all (ModestWindow *win,
gboolean force_connection,
- gboolean poke_status)
+ gboolean poke_status,
+ gboolean interactive)
{
GSList *account_names, *iter;
while (iter) {
modest_ui_actions_do_send_receive ((const char*) iter->data,
force_connection,
- poke_status, win);
+ poke_status, interactive, win);
iter = g_slist_next (iter);
}
/* Refresh the active account. Force the connection if needed
and poke the status of all folders */
- modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, win);
+ modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, TRUE, win);
}
TnyTransportAccount *server_account;
gchar *message = NULL;
- /* Don't show anything if the user cancelled something */
- if (err->code == TNY_SYSTEM_ERROR_CANCEL)
+ /* Don't show anything if the user cancelled something or the send receive request is not
+ * interactive */
+ if (err->code == TNY_SYSTEM_ERROR_CANCEL ||
+ !modest_tny_send_queue_get_requested_send_receive (MODEST_TNY_SEND_QUEUE (self)))
return;
+
/* Get the server name: */
server_account =
TNY_TRANSPORT_ACCOUNT (tny_camel_send_queue_get_transport_account (TNY_CAMEL_SEND_QUEUE (self)));
* @win: the window that will be used as source of the refresh mail operation
* @force_connection: whether or not the code should try to force a new connection if we're offline
* @poke_status: wheter ot not we want to poke the status of all mail folders
+ * @interactive: is coming from an interactive send receive.
*
* Refreshes all the accounts
**/
void modest_ui_actions_do_send_receive_all (ModestWindow *win,
gboolean force_connection,
- gboolean poke_status);
+ gboolean poke_status,
+ gboolean interactive);
/**
* modest_ui_actions_do_send_receive:
* @account_name: the name of the Modest account or NULL
* @force_connection: whether or not the code should try to force a new connection if we're offline
* @poke_status: wheter ot not we want to poke the status of all mail folders
+ * @interactive: is coming from an interactive send receive
* @win: the window that will be used as source of the refresh mail operation
*
* Refreshes the Modest account whose name is passed as argument. If
void modest_ui_actions_do_send_receive (const gchar *account_name,
gboolean force_connection,
gboolean poke_status,
+ gboolean interactive,
ModestWindow *win);
/**