* Fixes NB#81756, show the proper error note when the SMTP password is missing
pmo-trunk-r4339
static gboolean
notify_msg_not_found_in_idle (gpointer user_data)
{
- modest_platform_run_information_dialog (NULL, _("mail_ni_ui_folder_get_msg_folder_error"));
+ modest_platform_run_information_dialog (NULL, _("mail_ni_ui_folder_get_msg_folder_error"), FALSE);
return FALSE;
}
void
modest_platform_run_information_dialog (GtkWindow *parent_window,
- const gchar *message)
+ const gchar *message,
+ gboolean block)
{
GtkWidget *dialog;
if (resolved_contacts == NULL) {
/* no matching contacts for the search string */
- modest_platform_run_information_dialog (NULL, _("mcen_nc_no_matching_contacts"));
+ modest_platform_run_information_dialog (NULL, _("mcen_nc_no_matching_contacts"), FALSE);
return FALSE;
}
if (result != 1)
result = hildon_mime_open_file (con, uri_path);
if (result != 1)
- modest_platform_run_information_dialog (NULL, _("mcen_ni_noregistered_viewer"));
+ modest_platform_run_information_dialog (NULL, _("mcen_ni_noregistered_viewer"), FALSE);
return result != 1;
}
void
modest_platform_run_information_dialog (GtkWindow *parent_window,
- const gchar *message)
+ const gchar *message,
+ gboolean block)
{
GtkWidget *note;
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
GTK_WINDOW (note));
- g_signal_connect_swapped (note,
- "response",
- G_CALLBACK (on_destroy_dialog),
- note);
-
- gtk_widget_show_all (note);
-}
+ if (block) {
+ gtk_dialog_run (GTK_DIALOG (note));
+
+ on_destroy_dialog (GTK_DIALOG (note));
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+ } else {
+ g_signal_connect_swapped (note,
+ "response",
+ G_CALLBACK (on_destroy_dialog),
+ note);
+ gtk_widget_show_all (note);
+ }
+}
typedef struct _ConnectAndWaitData {
GMutex *mutex;
} else {
/* Just show the error text and use the default response: */
modest_platform_run_information_dialog (GTK_WINDOW (main_win),
- prompt);
+ prompt, FALSE);
}
return retval;
}
* modest_platform_run_information_dialog:
* @parent_window: the parent #GtkWindow of the dialog
* @message: the message to show
+ * @block: whether or not the dialog should block the main loop or not while running
*
* shows an information dialog
**/
void modest_platform_run_information_dialog (GtkWindow *parent_window,
- const gchar *message);
+ const gchar *message,
+ gboolean block);
/**
* modest_platform_run_sort_dialog:
static gchar*
get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *cancel)
{
- /* TODO: Settting cancel to FALSE does not actually cancel everything.
- * We still get multiple requests afterwards, so we end up showing the
- * same dialogs repeatedly.
- */
const TnyAccountStore *account_store = NULL;
ModestTnyAccountStore *self = NULL;
ModestTnyAccountStorePrivate *priv;
* ask for it now. But if the password is wrong in the account settings,
* then show a banner and the account settings dialog so it can be corrected:
*/
+ ModestTransportStoreProtocol proto;
const gboolean settings_have_password =
modest_account_mgr_get_server_account_has_password (priv->account_mgr, server_account_name);
- MODEST_DEBUG_BLOCK(
- printf ("%s: settings_have_password=%d\n",
- __FUNCTION__, settings_have_password);
- );
+
+ /* Show an error and after that ask for a password */
+ proto = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account));
+ if (proto == MODEST_PROTOCOL_TRANSPORT_SMTP) {
+ gchar *username = NULL, *msg = NULL;
+ username = modest_account_mgr_get_server_account_username (priv->account_mgr,
+ server_account_name);
+ if (!username || strlen(username) == 0) {
+ msg = g_strdup_printf (_("emev_ni_ui_smtp_userid_invalid"),
+ tny_account_get_name (account),
+ tny_account_get_hostname (account));
+ } else {
+ gchar *password;
+ password = modest_account_mgr_get_server_account_password (priv->account_mgr,
+ server_account_name);
+ if (!password || strlen(password) == 0)
+ msg = g_strdup_printf (_("emev_ni_ui_smtp_passwd_invalid"),
+ tny_account_get_name (account),
+ tny_account_get_hostname (account));
+ else
+ msg = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"),
+ tny_account_get_hostname (account));
+ if (password)
+ g_free (password);
+ }
+ if (msg) {
+ modest_platform_run_information_dialog (NULL, msg, TRUE);
+ g_free (msg);
+ }
+ if (username)
+ g_free (username);
+ }
+
if (settings_have_password) {
/* The password must be wrong, so show the account settings dialog so it can be corrected: */
show_wrong_password_dialog (account);
msg = g_strdup_printf (_("mcen_nc_unable_to_delete_n_messages"),
opened_headers);
- modest_platform_run_information_dialog (GTK_WINDOW (win), (const gchar *) msg);
+ modest_platform_run_information_dialog (GTK_WINDOW (win), (const gchar *) msg, FALSE);
g_free (msg);
g_object_unref (header_list);
GObject *win = modest_mail_operation_get_source (mail_op);
modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
- _("mail_in_ui_folder_delete_error"));
+ _("mail_in_ui_folder_delete_error"),
+ FALSE);
g_object_unref (win);
}
/* Show an error if it's an account */
if (!TNY_IS_FOLDER (folder)) {
modest_platform_run_information_dialog (GTK_WINDOW (main_window),
- _("mail_in_ui_folder_delete_error"));
+ _("mail_in_ui_folder_delete_error"),
+ FALSE);
g_object_unref (G_OBJECT (folder));
return;
}
/* Show notification dialog */
win = modest_mail_operation_get_source (mail_op);
- modest_platform_run_information_dialog ((GtkWindow *) win, _("mail_in_ui_folder_move_target_error"));
+ modest_platform_run_information_dialog ((GtkWindow *) win, _("mail_in_ui_folder_move_target_error"), FALSE);
if (win)
g_object_unref (win);
}
should show the Accounts Settings dialog or the Connection
specific SMTP server window */
- modest_platform_run_information_dialog (NULL, message);
+ modest_platform_run_information_dialog (NULL, message, FALSE);
g_free (message);
g_object_unref (server_account);
}
}
if (error_note) {
- modest_platform_run_information_dialog (parent_window, error_note);
+ modest_platform_run_information_dialog (parent_window, error_note, FALSE);
g_free (error_note);
}
}
saved = _modest_global_settings_dialog_save_conf (MODEST_GLOBAL_SETTINGS_DIALOG (dialog));
if (saved) {
modest_platform_run_information_dialog (GTK_WINDOW (user_data),
- _("mcen_ib_advsetup_settings_saved"));
+ _("mcen_ib_advsetup_settings_saved"),
+ FALSE);
} else {
modest_platform_run_information_dialog (GTK_WINDOW (user_data),
- _("mail_ib_setting_failed"));
+ _("mail_ib_setting_failed"),
+ FALSE);
}
}
} else {