* Added some useful debug code
[modest] / src / modest-tny-account-store.c
index 9ed5db9..4a4c4d1 100644 (file)
@@ -554,8 +554,11 @@ show_wrong_password_dialog (TnyAccount *account)
                                        
        gboolean created_dialog = FALSE;
        if (!found || !dialog) {
+               ModestAccountSettings *settings;
                dialog = modest_account_settings_dialog_new ();
-               modest_account_settings_dialog_set_account_name (dialog, modest_account_name);
+               settings = modest_account_mgr_load_account_settings (priv->account_mgr, modest_account_name);
+               modest_account_settings_dialog_set_account (dialog, settings);
+               g_object_unref (settings);
                modest_account_settings_dialog_switch_to_user_info (dialog);
                modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
                
@@ -1201,6 +1204,8 @@ get_tny_account_by (TnyList *accounts,
        gboolean found = FALSE;
        TnyAccount *retval = NULL;
 
+       g_return_val_if_fail (accounts && TNY_IS_LIST(accounts), NULL);
+
        iter = tny_list_create_iterator (accounts);
        while (!tny_iterator_is_done (iter) && !found) {
                TnyAccount *tmp_account = NULL;
@@ -1337,14 +1342,16 @@ TnyAccount*
 modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection (ModestTnyAccountStore *self,
                                                                                  const gchar *account_name)
 {
+       TnyDevice *device;
+
+       g_return_val_if_fail (self && MODEST_IS_TNY_ACCOUNT_STORE(self), NULL);
+       g_return_val_if_fail (account_name, NULL);
+
        /* Get the current connection: */
-       TnyDevice *device = modest_runtime_get_device ();
+       device = modest_runtime_get_device ();
        
        if (!tny_device_is_online (device))
                return NULL;
-
-       g_return_val_if_fail (self, NULL);
-       
        
 #ifdef MODEST_HAVE_CONIC
        g_return_val_if_fail (TNY_IS_MAEMO_CONIC_DEVICE (device), NULL);
@@ -1654,14 +1661,6 @@ on_account_disconnect_when_removing (TnyCamelAccount *account,
        self = MODEST_TNY_ACCOUNT_STORE (user_data);
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
 
-       if (canceled || err) {
-               /* The account was not cancelled */
-       } else {
-               /* Clear the cache if it's an store account */
-               if (TNY_IS_STORE_ACCOUNT (account))
-                       tny_store_account_delete_cache (TNY_STORE_ACCOUNT (account));
-       }
-
        /* Remove it from the list of accounts */
        if (TNY_IS_STORE_ACCOUNT (account))
                tny_list_remove (priv->store_accounts, (GObject *) account);
@@ -1674,10 +1673,15 @@ on_account_disconnect_when_removing (TnyCamelAccount *account,
        
        /* Unref the extra reference added by get_server_account */
        g_object_unref (account);
+
+       /* Clear the cache if it's an store account */
+       if (TNY_IS_STORE_ACCOUNT (account))
+               tny_store_account_delete_cache (TNY_STORE_ACCOUNT (account));
 }
 
 static void
-on_account_removed (ModestAccountMgr *acc_mgr, const gchar *account,
+on_account_removed (ModestAccountMgr *acc_mgr, 
+                   const gchar *account,
                    gpointer user_data)
 {
        TnyAccount *store_account = NULL, *transport_account = NULL;