/* Don't let the dialog close */
g_signal_stop_emission_by_name (wizard_dialog, "response");
return;
+ } else {
+ modest_tny_account_store_set_send_mail_blocked (modest_runtime_get_account_store (), FALSE);
}
if (response_id == GTK_RESPONSE_OK) {
modest_window_mgr_prevent_hibernation_while_window_is_shown (
modest_runtime_get_window_mgr (), GTK_WINDOW (self));
+ /* Prevent sending mails while editing an account, to avoid hangs on unprotected locks
+ * while sending messages causes an error dialog and we have a lock */
+ modest_tny_account_store_set_send_mail_blocked (modest_runtime_get_account_store (), TRUE);
+
hildon_help_dialog_help_enable (GTK_DIALOG(self), "applications_email_accountsettings",
modest_maemo_utils_get_osso_context());
}
update_account_send_mail (UpdateAccountInfo *info)
{
TnyTransportAccount *transport_account = NULL;
+ ModestTnyAccountStore *account_store;
+
+ account_store = modest_runtime_get_account_store ();
+
+ /* We don't try to send messages while sending mails is blocked */
+ if (modest_tny_account_store_is_send_mail_blocked (account_store))
+ return;
/* Get the transport account */
transport_account = (TnyTransportAccount *)
- modest_tny_account_store_get_transport_account_for_open_connection (modest_runtime_get_account_store(),
+ modest_tny_account_store_get_transport_account_for_open_connection (account_store,
info->account_name);
if (transport_account) {
/* Matches transport accounts and outbox folder */
GHashTable *outbox_of_transport;
+
+ /* is sending mail blocked? */
+ gboolean send_mail_blocked;
};
#define MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->session = NULL;
priv->device = NULL;
priv->sighandlers = NULL;
+ priv->send_mail_blocked = FALSE;
priv->outbox_of_transport = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
g_free (op_data);
}
}
+
+gboolean
+modest_tny_account_store_is_send_mail_blocked (ModestTnyAccountStore *self)
+{
+ ModestTnyAccountStorePrivate *priv;
+
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+ return priv->send_mail_blocked;
+}
+
+void
+modest_tny_account_store_set_send_mail_blocked (ModestTnyAccountStore *self,
+ gboolean blocked)
+{
+ ModestTnyAccountStorePrivate *priv;
+
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+ priv->send_mail_blocked = blocked;
+}
gpointer userdata);
+/**
+ * modest_tny_account_store_is_send_mail_blocked:
+ * @self: a #ModestTnyAccountStore
+ *
+ * Tells if we've blocked the send queue flush attempts temporally. This is
+ * usually done when we're editing an account, to prevent sending mails as
+ * it can cause problems
+ *
+ * Returns: %TRUE if sending mail is blocked
+ */
+gboolean modest_tny_account_store_is_send_mail_blocked (ModestTnyAccountStore *self);
+
+/**
+ * modest_tny_account_store_set_send_mail_blocked:
+ * @self: a #ModestTnyAccountStore
+ * @blocked: a #gboolean
+ *
+ * Sets as blocked/non blocked the send queue flush attempts temporally. This is
+ * usually done when we're editing an account, to prevent sending mails as
+ * it can cause problems
+ */
+void modest_tny_account_store_set_send_mail_blocked (ModestTnyAccountStore *self, gboolean blocked);
+
+
G_END_DECLS
#endif /* __MODEST_TNY_ACCOUNT_STORE_H__ */