- if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- if (username) {
- *username = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_username)));
-
- modest_account_mgr_set_server_account_username (
- modest_runtime_get_account_mgr(), server_account_name,
- *username);
-
- const gboolean username_was_changed =
- (strcmp (*username, initial_username) != 0);
- if (username_was_changed) {
- g_warning ("%s: tinymail does not yet support changing the "
- "username in the get_password() callback.\n", __FUNCTION__);
+ if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+ if (username) {
+ *username = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_username)));
+
+ /* Note that an empty field becomes the "" string */
+ if (*username && strlen (*username) > 0) {
+ modest_account_mgr_set_server_account_username (modest_runtime_get_account_mgr(),
+ server_account_name,
+ *username);
+ completed = TRUE;
+
+ const gboolean username_was_changed =
+ (strcmp (*username, initial_username) != 0);
+ if (username_was_changed) {
+ g_warning ("%s: tinymail does not yet support changing the "
+ "username in the get_password() callback.\n", __FUNCTION__);
+ }
+ } else {
+ /* Show error */
+ modest_platform_information_banner (GTK_WIDGET (dialog), NULL,
+ _("mcen_ib_username_pw_incorrect"));
+ completed = FALSE;
+ }