* src/modest-tny-local-folders-account.c,
[modest] / src / modest-tny-account-store.c
index f63e495..f1b221e 100644 (file)
@@ -145,6 +145,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), \
@@ -266,6 +269,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,
@@ -490,13 +494,6 @@ show_password_warning_only (const gchar *msg)
 static void 
 show_wrong_password_dialog (TnyAccount *account)
 { 
-<<<<<<< .working
-       /* This is easier than using a struct for the user_data: */
-       ModestTnyAccountStore *self = modest_runtime_get_account_store();
-       GtkWidget *dialog = NULL;
-
-=======
->>>>>>> .merge-right.r5668
        if (g_object_get_data (G_OBJECT (account), "connection_specific") != NULL) {
                modest_ui_actions_on_smtp_servers (NULL, NULL);
        } else {
@@ -516,6 +513,7 @@ show_wrong_password_dialog (TnyAccount *account)
                if (proto && MODEST_IS_ACCOUNT_PROTOCOL (proto)) {
                        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);
                        gtk_widget_show (GTK_WIDGET (dialog));
                }
        }
@@ -1043,7 +1041,7 @@ modest_tny_account_store_alert (TnyAccountStore *self,
                                GError *error)
 {
        ModestProtocolType protocol_type = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID;
-       ModestProtocol *protocol;
+       ModestProtocol *protocol = NULL;
        const gchar* server_name = "";
        gchar *prompt = NULL;
        gboolean retval = TRUE;
@@ -1077,7 +1075,9 @@ modest_tny_account_store_alert (TnyAccountStore *self,
        case TNY_SERVICE_ERROR_UNAVAILABLE:
                /* You must be working online for this operation */
        case TNY_SERVICE_ERROR_CONNECT:
-               prompt = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_CONNECT_ERROR, server_name);
+               if (protocol) {
+                       prompt = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_CONNECT_ERROR, server_name);
+               }
                if (!prompt) {
                        g_return_val_if_reached (FALSE);
                }
@@ -1087,7 +1087,9 @@ modest_tny_account_store_alert (TnyAccountStore *self,
                /* It seems that there's no better error to show with
                 * POP and IMAP because TNY_SERVICE_ERROR_AUTHENTICATE
                 * may appear if there's a timeout during auth */
-               prompt = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_AUTH_ERROR, server_name);
+               if (protocol) {
+                       prompt = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_AUTH_ERROR, server_name);
+               }
                if (!prompt) {
                        g_return_val_if_reached (FALSE);
                }
@@ -2208,3 +2210,24 @@ modest_tny_account_store_shutdown (ModestTnyAccountStore *self,
                g_free (op_data);
        }
 }
+
+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;
+}