+ ModestAccountViewWindowPrivate *priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
+
+ gchar* account_name = modest_account_view_get_selected_account (priv->account_view);
+ if (!account_name)
+ return;
+
+ /* Check whether any connections are active, and cancel them if
+ * the user wishes.
+ * TODO: Check only for connections with this account, instead of all.
+ * Maybe we need a queue per account.
+ */
+ ModestMailOperationQueue* queue = modest_runtime_get_mail_operation_queue ();
+ if (modest_mail_operation_queue_num_elements(queue)) {
+ GtkWidget *note = hildon_note_new_confirmation (GTK_WINDOW (self),
+ _("emev_nc_disconnect_account"));
+ const int response = gtk_dialog_run (GTK_DIALOG(note));
+ gtk_widget_destroy (note);
+ if (response == GTK_RESPONSE_OK) {
+ modest_mail_operation_queue_cancel_all(queue);
+ }
+ else
+ return;
+ }
+
+ /* Show the Account Settings window: */
+ ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
+ modest_account_settings_dialog_set_account_name (dialog, account_name);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ g_free (account_name);