* Clean up some code
[modest] / src / modest-tny-account-store.c
index 84e448b..0011265 100644 (file)
@@ -581,7 +581,12 @@ show_wrong_password_dialog (TnyAccount *account)
                        account, 0);
                        
                /* Show it and delete it when it closes: */
-               modest_maemo_show_dialog_and_forget (GTK_WINDOW (main_window), GTK_DIALOG (dialog));
+               gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (main_window));
+               g_signal_connect_swapped (dialog, 
+                                         "response", 
+                                         G_CALLBACK (gtk_widget_destroy), 
+                                         dialog);
+               gtk_widget_show (GTK_WIDGET (dialog));
        }
        else {
                /* Just show it instead of showing it and deleting it when it closes,
@@ -1655,12 +1660,16 @@ on_account_removed (ModestAccountMgr *acc_mgr, const gchar *account,
        /* If there was any problem creating the account, for example,
           with the configuration system this could not exist */
        if (store_account) {
+
+               /* do this before deleting the cache */
+               account_disconnect (store_account);
+               
                /* Clear the cache */
                tny_store_account_delete_cache (TNY_STORE_ACCOUNT (store_account));
 
                /* Notify the observers */
                g_signal_emit (G_OBJECT (self), signals [ACCOUNT_REMOVED_SIGNAL], 0, store_account);
-               account_disconnect (store_account); /* disconnect the account */
+
                g_object_unref (store_account);
        } else {
                g_warning ("There is no store account for account %s\n", account);