}
static gboolean
-is_memory_full_error (GError *error, ModestMailOperation *mail_op)
+is_memory_full_error (GError *error, ModestMailOperation *mail_op, gboolean *is_mmc)
{
gboolean enough_free_space = TRUE;
GnomeVFSURI *cache_dir_uri;
acc_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
+ if (is_mmc)
+ *is_mmc = FALSE;
+
/* Cache dir is different in case we're using an external storage (like MMC account) */
if (mail_op) {
TnyAccount *account = modest_mail_operation_get_account (mail_op);
if (account) {
if (modest_tny_account_is_memory_card_account (account)) {
+ if (is_mmc)
+ *is_mmc = TRUE;
cache_dir = g_getenv (MODEST_MMC1_VOLUMEPATH_ENV);
}
g_object_unref (account);
}
}
+/* Shows an error if we're in memory full conditions. The #alternate
+ parametter contains the error that will be shown if the memory full
+ conditions happen in the mmc external storage */
static gboolean
-check_memory_full_error (GtkWidget *parent_window, GError *err)
+check_memory_full_error (GtkWidget *parent_window, GError *err, const gchar *alternate)
{
+ gboolean is_mcc;
+
if (err == NULL)
return FALSE;
- if (is_memory_full_error (err, NULL)) {
- gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
- modest_platform_information_banner (parent_window, NULL, msg);
- g_free (msg);
+ if (is_memory_full_error (err, NULL, &is_mcc)) {
+ if (is_mcc && alternate) {
+ modest_platform_information_banner (parent_window, NULL, alternate);
+ } else {
+ gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
+ modest_platform_information_banner (parent_window, NULL, msg);
+ g_free (msg);
+ }
} else if (err->code == TNY_SYSTEM_ERROR_MEMORY)
/* If the account was created in memory full
conditions then tinymail won't be able to
/* If the mail op has been cancelled then it's not an error:
don't show any message */
if (status != MODEST_MAIL_OPERATION_STATUS_CANCELED) {
- if (is_memory_full_error ((GError *) error, mail_op)) {
+ if (is_memory_full_error ((GError *) error, mail_op, NULL)) {
gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
modest_platform_information_banner ((GtkWidget *) win, NULL, msg);
g_free (msg);
open_msg_helper_destroyer (helper);
/* In memory full conditions we could get this error here */
- check_memory_full_error ((GtkWidget *) parent_window, err);
+ check_memory_full_error ((GtkWidget *) parent_window, err, NULL);
goto clean;
}
if (err || canceled) {
/* In memory full conditions we could get this error here */
- check_memory_full_error ((GtkWidget *) parent_window, err);
+ check_memory_full_error ((GtkWidget *) parent_window, err, NULL);
if (info->mail_op) {
modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
stop the main loop in a gtk_dialog_run and then,
the message won't be shown until that dialog is
closed */
- modest_ui_actions_disk_operations_error_handler (mail_op,
- _("mail_in_ui_folder_create_error"));
-
- if (!is_memory_full_error ((GError *) error, mail_op)) {
- /* Try again if there is no full memory condition */
+ if (!check_memory_full_error ((GtkWidget *) source_win, (GError *) error,
+ _("mail_in_ui_folder_create_error_memory"))) {
+ /* Show an error and try again if there is no
+ full memory condition */
+ modest_platform_information_banner ((GtkWidget *) source_win, NULL,
+ _("mail_in_ui_folder_create_error"));
do_create_folder (source_win, parent_folder, (const gchar *) suggested_name);
}
} else {
if (canceled || err) {
/* In memory full conditions we could get this error here */
- check_memory_full_error ((GtkWidget *) parent_window, err);
+ check_memory_full_error ((GtkWidget *) parent_window, err,
+ _("mail_in_ui_folder_create_error_memory"));
/* This happens if we have selected the outbox folder
as the parent */
if (!error)
g_return_if_reached ();
- mem_full = is_memory_full_error ((GError *) error, mail_op);
+ mem_full = is_memory_full_error ((GError *) error, mail_op, NULL);
if (mem_full) {
message = g_strdup_printf (_KR("cerm_device_memory_full"), "");
} else if (error->domain == MODEST_MAIL_OPERATION_ERROR &&
if (canceled || err) {
/* In memory full conditions we could get this error here */
- check_memory_full_error ((GtkWidget *) parent_window, err);
+ check_memory_full_error ((GtkWidget *) parent_window, err, NULL);
} else {
mail_op =
win = modest_mail_operation_get_source (mail_op);
error = modest_mail_operation_get_error (mail_op);
- if (error && is_memory_full_error ((GError *) error, mail_op)) {
+ if (error && is_memory_full_error ((GError *) error, mail_op, NULL)) {
gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
modest_platform_information_banner ((GtkWidget *) win, NULL, msg);
g_free (msg);
helper = (XferMsgsHelper *) user_data;
if (canceled || err) {
- if (!check_memory_full_error ((GtkWidget *) parent_window, err)) {
+ if (!check_memory_full_error ((GtkWidget *) parent_window, err, NULL)) {
/* Show the proper error message */
modest_ui_actions_on_account_connection_error (parent_window, account);
}
TnyList *headers = TNY_LIST (user_data);
if (err || canceled) {
- check_memory_full_error ((GtkWidget *) parent_window, err);
+ check_memory_full_error ((GtkWidget *) parent_window, err, NULL);
goto out;
}