Do ignore '\n' when splitting addresses
[modest] / src / modest-tny-account-store.c
index 1772c02..9a610d0 100644 (file)
@@ -489,10 +489,12 @@ on_account_changed (ModestAccountMgr *acc_mgr,
        g_object_unref (iter);
 }
 
-static void 
-show_wrong_password_dialog (TnyAccount *account, 
+static void
+show_wrong_password_dialog (TnyAccount *account,
                            gboolean show_banner)
-{ 
+{
+       g_debug ("%s: %s", __FUNCTION__, tny_account_get_id (account));
+
        if (g_object_get_data (G_OBJECT (account), "connection_specific") != NULL) {
                modest_ui_actions_on_smtp_servers (NULL, NULL);
        } else {
@@ -510,9 +512,16 @@ show_wrong_password_dialog (TnyAccount *account,
 
                /* Create and show the dialog */
                if (proto && MODEST_IS_ACCOUNT_PROTOCOL (proto)) {
+                       GtkWindow *parent;
+                       ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
                        ModestAccountSettingsDialog *dialog =
                                modest_account_protocol_get_account_settings_dialog (proto, modest_account_name);
-                       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), NULL);
+
+                       parent = modest_window_mgr_get_modal (mgr);
+                       if (!parent)
+                               parent = (GtkWindow *) modest_window_mgr_get_current_top (mgr);
+
+                       modest_window_mgr_set_modal (mgr, GTK_WINDOW (dialog), parent);
                        gtk_widget_show (GTK_WIDGET (dialog));
                }
        }
@@ -541,9 +550,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
 
        g_return_val_if_fail (account, NULL);
 
-       MODEST_DEBUG_BLOCK(
-               g_debug ("%s: prompt (not shown) = %s\n", __FUNCTION__, prompt_not_used);
-       );
+       g_debug ("%s: %s", __FUNCTION__, prompt_not_used);
 
        /* Get a reference to myself */
        self = MODEST_TNY_ACCOUNT_STORE (g_object_get_data (G_OBJECT(account), "account_store"));
@@ -690,6 +697,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
 
                if (settings_have_password) {
                        if (pwd) {
+                               g_debug ("%s: going to show the dialog. Attempt count is %d", __FUNCTION__, attempt->count);
                                /* The password must be wrong, so show the account settings dialog so it can be corrected: */
                                show_wrong_password_dialog (account, TRUE);
 
@@ -1082,7 +1090,8 @@ modest_tny_account_store_alert (TnyAccountStore *self,
        gboolean retval = TRUE;
 
        /* NOTE: account may be NULL in some cases */
-       g_return_val_if_fail (error, FALSE);
+       if (!error)
+               return FALSE;
 
        /* Get the server name: */
        if (account) {
@@ -1166,6 +1175,9 @@ modest_tny_account_store_alert (TnyAccountStore *self,
                                                                                        tny_account_get_id (account));
 
                if (!success) {
+                       g_debug ("%s: %s alert received (%s)", __FUNCTION__,
+                                (error->code == TNY_SERVICE_ERROR_CONNECT) ? "connect" : "aunthenticate",
+                                error->message);
 
                        modest_platform_run_information_dialog (NULL, prompt, TRUE);