+static gboolean
+_sending_in_progress (ModestWindow *win)
+{
+ ModestTnySendQueue *send_queue = NULL;
+ ModestTnyAccountStore *acc_store = NULL;
+ TnyAccount *account = NULL;
+ const gchar *account_name = NULL;
+ gboolean result = FALSE;
+
+ /* Get transport account */
+ acc_store = modest_runtime_get_account_store();
+ account_name = modest_window_get_active_account (win);
+
+ /* If no account defined, this action must be always dimmed */
+ if (account_name == NULL) return FALSE;
+ account = modest_tny_account_store_get_transport_account_for_open_connection (acc_store, account_name);
+ if (!TNY_IS_TRANSPORT_ACCOUNT (account)) return FALSE;
+
+ /* Get send queue for current ransport account */
+ send_queue = modest_runtime_get_send_queue (TNY_TRANSPORT_ACCOUNT(account));
+ g_return_val_if_fail (MODEST_IS_TNY_SEND_QUEUE (send_queue), FALSE);
+
+ /* Check if send queue is perfimring any send operation */
+ result = modest_tny_send_queue_sending_in_progress (send_queue);
+
+ return result;
+}