}
static gboolean
-is_memory_full_error (GError *error)
+is_memory_full_error (GError *error, ModestMailOperation *mail_op)
{
gboolean enough_free_space = TRUE;
GnomeVFSURI *cache_dir_uri;
- const gchar *cache_dir;
+ const gchar *cache_dir = NULL;
GnomeVFSFileSize free_space;
+ TnyAccountStore *acc_store;
+
+ acc_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
+
+ /* 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)) {
+ cache_dir = g_getenv (MODEST_MMC1_VOLUMEPATH_ENV);
+ }
+ g_object_unref (account);
+ }
+ }
+
+ /* Get the default local cache dir */
+ if (!cache_dir)
+ cache_dir = tny_account_store_get_cache_dir (acc_store);
- cache_dir = tny_account_store_get_cache_dir (TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
cache_dir_uri = gnome_vfs_uri_new (cache_dir);
- if (gnome_vfs_get_volume_free_space (cache_dir_uri, &free_space) == GNOME_VFS_OK) {
- if (free_space < MIN_FREE_SPACE)
- enough_free_space = FALSE;
+ if (cache_dir_uri) {
+ if (gnome_vfs_get_volume_free_space (cache_dir_uri, &free_space) == GNOME_VFS_OK) {
+ if (free_space < MIN_FREE_SPACE)
+ enough_free_space = FALSE;
+ }
+ gnome_vfs_uri_unref (cache_dir_uri);
}
- gnome_vfs_uri_unref (cache_dir_uri);
if ((error->code == TNY_SYSTEM_ERROR_MEMORY ||
/* When asking for a mail and no space left on device
if (err == NULL)
return FALSE;
- if (is_memory_full_error (err))
+ if (is_memory_full_error (err, NULL))
modest_platform_information_banner (parent_window,
NULL, _KR("cerm_device_memory_full"));
else if (err->code == TNY_SYSTEM_ERROR_MEMORY)
/* 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)) {
+ if (is_memory_full_error ((GError *) error, mail_op)) {
modest_platform_information_banner ((GtkWidget *) win,
NULL, _KR("cerm_device_memory_full"));
} else if (error->code == TNY_SYSTEM_ERROR_MEMORY) {
parent_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
#endif
- if (parent_folder)
+ if (parent_folder) {
do_create_folder (GTK_WINDOW (parent_window), parent_folder, NULL);
+ g_object_unref (parent_folder);
+ }
}
void
win = modest_mail_operation_get_source (mail_op);
error = modest_mail_operation_get_error (mail_op);
- if (error && is_memory_full_error ((GError *) error))
+ if (error && is_memory_full_error ((GError *) error, mail_op))
modest_platform_information_banner ((GtkWidget *) win,
NULL, _KR("cerm_device_memory_full"));
else
gpointer user_data)
{
const gchar* server_name = NULL;
- TnyTransportAccount *server_account;
+ TnyTransportAccount *transport;
gchar *message = NULL;
+ ModestProtocol *protocol;
/* Don't show anything if the user cancelled something or the
* send receive request is not interactive. Authentication
return;
- /* Get the server name: */
- server_account =
- TNY_TRANSPORT_ACCOUNT (tny_camel_send_queue_get_transport_account (TNY_CAMEL_SEND_QUEUE (self)));
- if (server_account)
- server_name = tny_account_get_hostname (TNY_ACCOUNT (server_account));
- else
- g_return_if_reached ();
+ /* Get the server name. Note that we could be using a
+ connection specific transport account */
+ transport = (TnyTransportAccount *)
+ tny_camel_send_queue_get_transport_account (TNY_CAMEL_SEND_QUEUE (self));
+ if (transport) {
+ ModestTnyAccountStore *acc_store;
+ const gchar *acc_name;
+ TnyTransportAccount *conn_specific;
+
+ acc_store = modest_runtime_get_account_store();
+ acc_name = modest_tny_account_get_parent_modest_account_name_for_server_account (TNY_ACCOUNT (transport));
+ conn_specific = (TnyTransportAccount *)
+ modest_tny_account_store_get_transport_account_for_open_connection (acc_store, acc_name);
+ if (conn_specific) {
+ server_name = tny_account_get_hostname (TNY_ACCOUNT (conn_specific));
+ g_object_unref (conn_specific);
+ } else {
+ server_name = tny_account_get_hostname (TNY_ACCOUNT (transport));
+ }
+ g_object_unref (transport);
+ }
+
+ /* Get protocol */
+ protocol = modest_protocol_registry_get_protocol_by_name (modest_runtime_get_protocol_registry (),
+ MODEST_PROTOCOL_REGISTRY_TRANSPORT_STORE_PROTOCOLS,
+ tny_account_get_proto (TNY_ACCOUNT (transport)));
+ if (!protocol) {
+ g_warning ("%s: Account with no proto", __FUNCTION__);
+ return;
+ }
/* Show the appropriate message text for the GError: */
switch (err->code) {
case TNY_SERVICE_ERROR_CONNECT:
- message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
+ message = modest_protocol_get_translation (protocol,
+ MODEST_PROTOCOL_TRANSLATION_ACCOUNT_CONNECTION_ERROR,
+ server_name);
break;
case TNY_SERVICE_ERROR_SEND:
message = g_strdup (_CS("sfil_ib_unable_to_send"));
break;
case TNY_SERVICE_ERROR_UNAVAILABLE:
- message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
+ message = modest_protocol_get_translation (protocol,
+ MODEST_PROTOCOL_TRANSLATION_CONNECT_ERROR,
+ server_name);
break;
default:
g_warning ("%s: unexpected ERROR %d",
modest_platform_run_information_dialog (NULL, message, FALSE);
g_free (message);
- g_object_unref (server_account);
}
void