+ /* const gchar *prompt = NULL; */
+ gchar *prompt = NULL;
+ switch (error->code) {
+ case TNY_ACCOUNT_ERROR_TRY_CONNECT:
+ /* The tinymail camel implementation just sends us this for almost
+ * everything, so we have to guess at the cause.
+ * It could be a wrong password, or inability to resolve a hostname,
+ * or lack of network, or incorrect authentication method, or something entirely different: */
+ /* TODO: Fix camel to provide specific error codes, and then use the
+ * specific dialog messages from Chapter 12 of the UI spec.
+ */
+ case TNY_ACCOUNT_STORE_ERROR_UNKNOWN_ALERT:
+/* g_debug ("%s: Handling GError domain=%d, code=%d, message=%s", */
+/* __FUNCTION__, error->domain, error->code, error->message); */
+
+ /* TODO: Remove the internal error message for the real release.
+ * This is just so the testers can give us more information: */
+ /* prompt = _("Modest account not yet fully configured."); */
+ prompt = g_strdup_printf(
+ "%s\n (Internal error message, often very misleading):\n%s",
+ _("Incorrect Account Settings"),
+ error->message);
+
+ /* TODO: If we can ever determine that the problem is a wrong password:
+ * In this case, the UI spec wants us to show a banner, and then
+ * open the Account Settings dialog. */
+ /* Note: Sometimes, the get_password() function seems to be called again
+ * when a password is wrong, but sometimes this alert_func is called. */
+ #if 0
+ GtkWidget *parent_widget =
+ GTK_WIDGET (
+ modest_window_mgr_get_main_window (
+ modest_runtime_get_window_mgr ()));
+
+ hildon_banner_show_information (
+ parent_widget,
+ NULL /* icon name */,
+ _("mcen_ib_username_pw_incorrect") );
+
+ /* Show the Account Settings window: */
+ ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
+ /* TODO: Get the account somehow. Maybe tinymail should send it with the signal. */
+ const gchar* modest_account_name =
+ modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ g_assert (modest_account_name);
+ modest_account_settings_dialog_set_account_name (dialog,
+ modest_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));
+ #endif
+
+ break;
+
+ //TODO: We have started receiving errors of
+ //domain=TNY_ACCOUNT_ERROR, code=TNY_ACCOUNT_ERROR_TRY_CONNECT, message="Canceled".
+ //If this is really a result of us cancelling our own operation then
+ //a) this probably shouldn't be an error, and
+ //b) should have its own error code.
+
+ default:
+ g_warning ("%s: Unhandled GError code: %d, message=%s",
+ __FUNCTION__, error->code, error->message);
+ prompt = NULL;
+ break;
+ }
+
+ if (!prompt)
+ return FALSE;
+
+#ifdef MODEST_PLATFORM_MAEMO
+ /* The Tinymail documentation says that we should show Yes and No buttons,
+ * when it is a question.
+ * Obviously, we need tinymail to use more specific error codes instead,
+ * so we know what buttons to show. */
+ GtkWidget *dialog = NULL;
+ if (question) {
+ dialog = GTK_WIDGET (hildon_note_new_confirmation (NULL,
+ prompt));
+ } else {
+ dialog = GTK_WIDGET (hildon_note_new_information (NULL,
+ prompt));
+ }
+#else
+
+ GtkMessageType gtktype = GTK_MESSAGE_ERROR;