Added bug 90185 to changelog
[modest] / src / modest-tny-account-store.c
index a92390a..c99e5e7 100644 (file)
@@ -144,6 +144,9 @@ struct _ModestTnyAccountStorePrivate {
        
        /* Matches transport accounts and outbox folder */
        GHashTable          *outbox_of_transport;
+
+       /* is sending mail blocked? */
+       gboolean send_mail_blocked;
 };
 
 #define MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -265,6 +268,7 @@ modest_tny_account_store_instance_init (ModestTnyAccountStore *obj)
        priv->session                = NULL;
        priv->device                 = NULL;
        priv->sighandlers            = NULL;
+       priv->send_mail_blocked      = FALSE;
        
        priv->outbox_of_transport = g_hash_table_new_full (g_direct_hash,
                                                           g_direct_equal,
@@ -572,7 +576,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
        /* Get a reference to myself */
        self = MODEST_TNY_ACCOUNT_STORE (g_object_get_data (G_OBJECT(account), "account_store"));
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
+       
        /* Ensure that we still have this account. It could happen
           that a set_online was requested *before* removing an
           account, and due to tinymail emits the get_password
@@ -860,6 +864,8 @@ modest_tny_account_store_finalize (GObject *obj)
                priv->session = NULL;
        }
 
+       camel_shutdown ();
+
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -1069,7 +1075,7 @@ modest_tny_account_store_alert (TnyAccountStore *self,
                MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN; 
        const gchar* server_name = "";
        gchar *prompt = NULL;
-       gboolean retval;
+       gboolean retval = TRUE;
 
        /* NOTE: account may be NULL in some cases */
        g_return_val_if_fail (error, FALSE);
@@ -1158,7 +1164,7 @@ modest_tny_account_store_alert (TnyAccountStore *self,
        if (error->code == TNY_SERVICE_ERROR_CERTIFICATE)
                retval = modest_platform_run_certificate_confirmation_dialog (server_name,
                                                                              error->message);
-       else {
+       else if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE) {
                modest_platform_run_information_dialog (NULL, prompt, TRUE);
 
                /* Show the account dialog if it was wrong */
@@ -1169,6 +1175,7 @@ modest_tny_account_store_alert (TnyAccountStore *self,
                retval = TRUE;
        }
 
+       g_debug ("%s: error code %d (%s", __FUNCTION__, error->code, error->message);
        
        if (prompt)
                g_free (prompt);
@@ -2151,7 +2158,7 @@ modest_tny_account_store_get_transport_account_from_outbox_header(ModestTnyAccou
 
 GtkWidget *
 modest_tny_account_store_show_account_settings_dialog (ModestTnyAccountStore *self,
-                                                     const gchar *account_name)
+                                                      const gchar *account_name)
 {
        ModestTnyAccountStorePrivate *priv;
        gpointer dialog_as_gpointer = NULL;
@@ -2169,7 +2176,6 @@ modest_tny_account_store_show_account_settings_dialog (ModestTnyAccountStore *se
                GtkWidget *dialog;
                dialog = (GtkWidget *) modest_account_settings_dialog_new ();
                settings = modest_account_mgr_load_account_settings (priv->account_mgr, account_name);
-               modest_account_settings_dialog_save_password (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
                modest_account_settings_dialog_set_account (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog), settings);
                g_object_unref (settings);
                modest_account_settings_dialog_switch_to_user_info (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
@@ -2192,3 +2198,24 @@ modest_tny_account_store_show_account_settings_dialog (ModestTnyAccountStore *se
        }
        
 }
+
+gboolean 
+modest_tny_account_store_is_send_mail_blocked (ModestTnyAccountStore *self)
+{
+       ModestTnyAccountStorePrivate *priv;
+
+       priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+       return priv->send_mail_blocked;
+}
+
+void 
+modest_tny_account_store_set_send_mail_blocked (ModestTnyAccountStore *self, 
+                                               gboolean blocked)
+{
+       ModestTnyAccountStorePrivate *priv;
+
+       priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+       priv->send_mail_blocked = blocked;
+}