gdk_threads_enter ();
mail_op_queue = modest_runtime_get_mail_operation_queue ();
- if (modest_mail_operation_queue_running_shutdown (mail_op_queue)) {
+ if (modest_tny_account_store_is_shutdown (modest_runtime_get_account_store ()) &&
+ modest_mail_operation_queue_running_shutdown (mail_op_queue)) {
/* Disconnect signals. Will be freed by the destroy notify */
handlers = (MainSignalHandlers *) data;
}
gboolean
+modest_tny_account_store_is_shutdown (ModestTnyAccountStore *self)
+{
+ ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
+ TnyIterator *iter;
+ gboolean found;
+
+ found = FALSE;
+
+ for (iter = tny_list_create_iterator (priv->store_accounts);
+ !found && !tny_iterator_is_done (iter);
+ tny_iterator_next (iter)) {
+ TnyAccount *account;
+
+ account = (TnyAccount *) tny_iterator_get_current (iter);
+ if (TNY_IS_ACCOUNT (account)) {
+ found = (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_CONNECTED) ||
+ (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_RECONNECTING);
+ }
+ g_object_unref (account);
+ }
+ g_object_unref (iter);
+
+ if (found)
+ return !found;
+
+ for (iter = tny_list_create_iterator (priv->transport_accounts);
+ !found && !tny_iterator_is_done (iter);
+ tny_iterator_next (iter)) {
+ TnyAccount *account;
+
+ account = (TnyAccount *) tny_iterator_get_current (iter);
+ if (TNY_IS_ACCOUNT (account)) {
+ found = (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_CONNECTED) ||
+ (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_RECONNECTING);
+ }
+ g_object_unref (account);
+ }
+ g_object_unref (iter);
+
+ return !found;
+
+}
+
+
+gboolean
modest_tny_account_store_is_send_mail_blocked (ModestTnyAccountStore *self)
{
ModestTnyAccountStorePrivate *priv;
void modest_tny_account_store_shutdown (ModestTnyAccountStore *self,
ModestTnyAccountStoreShutdownCallback callback,
gpointer userdata);
-
+
+/**
+ * modest_tny_account_store_is_shutdown:
+ * @self: a #ModestTnyAccountStore
+ *
+ * Check if all accounts are disconnected
+ *
+ * Returns: %TRUE if all accounts are disconnected, %FALSE otherwise.
+ */
+gboolean modest_tny_account_store_is_shutdown (ModestTnyAccountStore *self);
/**
* modest_tny_account_store_is_send_mail_blocked: