#include "modest-text-utils.h"
#ifdef MODEST_HAVE_EASYSETUP
-#include "easysetup/modest-easysetup-wizard.h"
+#include "easysetup/modest-easysetup-wizard-dialog.h"
#endif /* MODEST_HAVE_EASYSETUP */
#include <modest-widget-memory.h>
static TnyAccount *get_account_from_folder_store (TnyFolderStore *folder_store);
-static void transfer_messages_helper (GtkWindow *win,
- TnyFolder *src_folder,
- TnyList *headers,
- TnyFolder *dst_folder);
-
/*
* This function checks whether a TnyFolderStore is a pop account
*/
msg = g_strdup_printf (_("mcen_nc_unable_to_delete_n_messages"),
opened_headers);
- modest_platform_run_information_dialog (GTK_WINDOW (win), (const gchar *) msg);
+ modest_platform_run_information_dialog (GTK_WINDOW (win), (const gchar *) msg, FALSE);
g_free (msg);
g_object_unref (header_list);
iter = tny_list_create_iterator (header_list);
header = TNY_HEADER (tny_iterator_get_current (iter));
if (header) {
- desc = g_strdup_printf ("%s", tny_header_get_subject (header));
+ gchar *subject;
+ subject = tny_header_dup_subject (header);
+ desc = g_strdup_printf ("%s", subject);
+ g_free (subject);
g_object_unref (header);
}
ModestWindow *msg_win = NULL;
ModestAccountMgr *mgr = modest_runtime_get_account_mgr();
ModestTnyAccountStore *store = modest_runtime_get_account_store();
+ GnomeVFSFileSize total_size, allowed_size;
+
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * composing a message with attachments
+ */
+ if (attachments && modest_platform_check_memory_low (win))
+ goto cleanup;
account_name = modest_account_mgr_get_default_account(mgr);
if (!account_name) {
/* Create and register edit window */
/* This is destroyed by TODO. */
+ total_size = 0;
+ allowed_size = MODEST_MAX_ATTACHMENT_SIZE;
msg_win = modest_msg_edit_window_new (msg, account_name, FALSE);
while (attachments) {
- modest_msg_edit_window_attach_file_one((ModestMsgEditWindow *)msg_win,
- attachments->data);
+ total_size +=
+ modest_msg_edit_window_attach_file_one(
+ (ModestMsgEditWindow *)msg_win,
+ attachments->data, allowed_size);
+
+ if (total_size > allowed_size) {
+ g_warning ("%s: total size: %u",
+ __FUNCTION__, (unsigned int)total_size);
+ break;
+ }
+ allowed_size -= total_size;
+
attachments = g_slist_next(attachments);
}
modest_window_mgr_register_window (modest_runtime_get_window_mgr(), msg_win);
g_free (signature);
g_free (body);
g_free (account_name);
- if (account) g_object_unref (G_OBJECT(account));
- if (folder) g_object_unref (G_OBJECT(folder));
- if (msg_win) g_object_unref (G_OBJECT(msg_win));
- if (msg) g_object_unref (G_OBJECT(msg));
+ if (account)
+ g_object_unref (G_OBJECT(account));
+ if (folder)
+ g_object_unref (G_OBJECT(folder));
+ if (msg_win)
+ g_object_unref (G_OBJECT(msg_win));
+ if (msg)
+ g_object_unref (G_OBJECT(msg));
}
void
GtkWidget *banner;
} OpenMsgBannerInfo;
+typedef struct {
+ GtkTreeModel *model;
+ TnyList *headers;
+ OpenMsgBannerInfo *banner_info;
+ GHashTable *row_refs_per_header;
+} OpenMsgHelper;
+
gboolean
open_msg_banner_idle (gpointer userdata)
{
gchar *account = NULL;
TnyFolder *folder;
gboolean open_in_editor = FALSE;
- OpenMsgBannerInfo *banner_info = (OpenMsgBannerInfo *) user_data;
+ OpenMsgHelper *helper = (OpenMsgHelper *) user_data;
/* Do nothing if there was any problem with the mail
operation. The error will be shown by the error_handler of
the mail operation */
if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg))
- goto banner_cleanup;
+ return;
parent_win = (ModestWindow *) modest_mail_operation_get_source (mail_op);
folder = tny_header_get_folder (header);
if (open_in_editor) {
ModestAccountMgr *mgr = modest_runtime_get_account_mgr ();
- const gchar *from_header = NULL;
+ gchar *from_header = NULL;
- from_header = tny_header_get_from (header);
+ from_header = tny_header_dup_from (header);
/* we cannot edit without a valid account... */
if (!modest_account_mgr_has_accounts(mgr, TRUE)) {
- if (!modest_ui_actions_run_account_setup_wizard(parent_win))
+ if (!modest_ui_actions_run_account_setup_wizard(parent_win)) {
+ modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (),
+ header);
+ g_free (from_header);
goto cleanup;
+ }
}
if (from_header) {
}
g_free (from);
}
+ g_free (from_header);
g_slist_foreach (accounts, (GFunc) g_free, NULL);
g_slist_free (accounts);
}
gchar *uid = modest_tny_folder_get_header_unique_id (header);
if (MODEST_IS_MAIN_WINDOW (parent_win)) {
- GtkWidget *header_view;
- GtkTreeSelection *sel;
- GList *sel_list = NULL;
- GtkTreeModel *model;
-
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(parent_win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-
- sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view));
- sel_list = gtk_tree_selection_get_selected_rows (sel, &model);
+ GtkTreeRowReference *row_reference;
- if (sel_list != NULL) {
- GtkTreeRowReference *row_reference;
-
- row_reference = gtk_tree_row_reference_new (model, (GtkTreePath *) sel_list->data);
- g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (sel_list);
+ row_reference = (GtkTreeRowReference *) g_hash_table_lookup (helper->row_refs_per_header, header);
- win = modest_msg_view_window_new_with_header_model (
- msg, account, (const gchar*) uid,
- model, row_reference);
- gtk_tree_row_reference_free (row_reference);
- } else {
- win = modest_msg_view_window_new_for_attachment (msg, account, (const gchar*) uid);
- }
+ win = modest_msg_view_window_new_with_header_model (msg, account, (const gchar*) uid,
+ helper->model, row_reference);
} else {
win = modest_msg_view_window_new_for_attachment (msg, account, (const gchar*) uid);
}
g_free(account);
g_object_unref (parent_win);
g_object_unref (folder);
-banner_cleanup:
- if (banner_info) {
- g_free (banner_info->message);
- if (banner_info->idle_handler > 0) {
- g_source_remove (banner_info->idle_handler);
- banner_info->idle_handler = 0;
- }
- if (banner_info->banner != NULL) {
- gtk_widget_destroy (banner_info->banner);
- g_object_unref (banner_info->banner);
- banner_info->banner = NULL;
- }
- g_slice_free (OpenMsgBannerInfo, banner_info);
+}
+
+static gboolean
+is_memory_full_error (GError *error)
+{
+ if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
+ error->code == TNY_IO_ERROR_WRITE ||
+ error->code == TNY_IO_ERROR_READ) {
+ return TRUE;
+ } else {
+ return FALSE;
}
}
void
-modest_ui_actions_get_msgs_full_error_handler (ModestMailOperation *mail_op,
- gpointer user_data)
+modest_ui_actions_disk_operations_error_handler (ModestMailOperation *mail_op,
+ gpointer user_data)
{
const GError *error;
GObject *win = NULL;
+ ModestMailOperationStatus status;
win = modest_mail_operation_get_source (mail_op);
error = modest_mail_operation_get_error (mail_op);
+ status = modest_mail_operation_get_status (mail_op);
- /* Show error */
- if (error->code == TNY_SYSTEM_ERROR_MEMORY ||
- error->code == TNY_IO_ERROR_WRITE ||
- error->code == TNY_IO_ERROR_READ) {
- ModestMailOperationStatus st = modest_mail_operation_get_status (mail_op);
- /* If the mail op has been cancelled then it's not an error: don't show any message */
- if (st != MODEST_MAIL_OPERATION_STATUS_CANCELED) {
+ /* 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)) {
modest_platform_information_banner ((GtkWidget *) win,
NULL, dgettext("ke-recv",
"cerm_device_memory_full"));
+ } else if (user_data) {
+ modest_platform_information_banner ((GtkWidget *) win,
+ NULL, user_data);
}
- } else if (user_data) {
- modest_platform_information_banner ((GtkWidget *) win,
- NULL, user_data);
}
if (win)
TnyIterator *iter = tny_list_create_iterator (headers);
TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter));
TnyFolder *folder = tny_header_get_folder (header);
- account = tny_folder_get_account (folder);
- g_object_unref (folder);
- g_object_unref (header);
+
+ if (!folder) {
+ g_object_unref (header);
+
+ while (!tny_iterator_is_done (iter)) {
+ header = TNY_HEADER (tny_iterator_get_current (iter));
+ folder = tny_header_get_folder (header);
+ if (folder)
+ break;
+ g_object_unref (header);
+ header = NULL;
+ tny_iterator_next (iter);
+ }
+ }
+
+ if (folder) {
+ account = tny_folder_get_account (folder);
+ g_object_unref (folder);
+ }
+
+ if (header)
+ g_object_unref (header);
+
g_object_unref (iter);
}
return account;
}
static void
+open_msgs_helper_destroyer (gpointer user_data)
+{
+ OpenMsgHelper *helper = (OpenMsgHelper *) user_data;
+
+ if (helper->banner_info) {
+ g_free (helper->banner_info->message);
+ if (helper->banner_info->idle_handler > 0) {
+ g_source_remove (helper->banner_info->idle_handler);
+ helper->banner_info->idle_handler = 0;
+ }
+ if (helper->banner_info->banner != NULL) {
+ gtk_widget_destroy (helper->banner_info->banner);
+ g_object_unref (helper->banner_info->banner);
+ helper->banner_info->banner = NULL;
+ }
+ g_slice_free (OpenMsgBannerInfo, helper->banner_info);
+ helper->banner_info = NULL;
+ }
+ g_object_unref (helper->model);
+ g_object_unref (helper->headers);
+ g_hash_table_destroy (helper->row_refs_per_header);
+ g_slice_free (OpenMsgHelper, helper);
+}
+
+static void
open_msgs_performer(gboolean canceled,
GError *err,
GtkWindow *parent_window,
TnyList *not_opened_headers;
TnyConnectionStatus status;
gboolean show_open_draft = FALSE;
- OpenMsgBannerInfo *banner_info = NULL;
+ OpenMsgHelper *helper = NULL;
- not_opened_headers = TNY_LIST (user_data);
+ helper = (OpenMsgHelper *) user_data;
+ not_opened_headers = helper->headers;
status = tny_account_get_connection_status (account);
if (err || canceled) {
/* Unregister the already registered headers */
tny_list_foreach (not_opened_headers, foreach_unregister_headers,
modest_runtime_get_window_mgr ());
+ /* Free the helper */
+ open_msgs_helper_destroyer (helper);
+
+ /* In memory full conditions we could get this error here */
+ if (err && is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ }
goto clean;
}
} else if (proto == MODEST_PROTOCOL_STORE_IMAP) {
TnyIterator *iter = tny_list_create_iterator (not_opened_headers);
TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter));
+ gchar *subject = tny_header_dup_subject (header);
error_msg = g_strdup_printf (_("emev_ni_ui_imap_message_not_available_in_server"),
- tny_header_get_subject (header));
+ subject);
+ g_free (subject);
g_object_unref (header);
g_object_unref (iter);
} else {
/* Create the mail operation */
mail_op =
modest_mail_operation_new_with_error_handling ((GObject *) parent_window,
- modest_ui_actions_get_msgs_full_error_handler,
+ modest_ui_actions_disk_operations_error_handler,
error_msg, g_free);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
if (show_open_draft) {
- banner_info = g_slice_new (OpenMsgBannerInfo);
- banner_info->message = g_strdup (_("mail_ib_opening_draft_message"));
- banner_info->banner = NULL;
- banner_info->idle_handler = g_timeout_add (500, open_msg_banner_idle, banner_info);
+ helper->banner_info = g_slice_new (OpenMsgBannerInfo);
+ helper->banner_info->message = g_strdup (_("mail_ib_opening_draft_message"));
+ helper->banner_info->banner = NULL;
+ helper->banner_info->idle_handler = g_timeout_add (500, open_msg_banner_idle,
+ helper->banner_info);
}
modest_mail_operation_get_msgs_full (mail_op,
not_opened_headers,
open_msg_cb,
- banner_info,
- NULL);
+ helper,
+ open_msgs_helper_destroyer);
/* Frees */
clean:
if (mail_op)
g_object_unref (mail_op);
- g_object_unref (not_opened_headers);
g_object_unref (account);
}
TnyHeaderFlags flags = 0;
TnyAccount *account;
gint uncached_msgs = 0;
+ GtkWidget *header_view;
+ GtkTreeModel *model;
+ GHashTable *refs_for_headers;
+ OpenMsgHelper *helper;
+ GtkTreeSelection *sel;
+ GList *sel_list = NULL, *sel_list_iter = NULL;
g_return_if_fail (headers != NULL);
/* Check that only one message is selected for opening */
if (tny_list_get_length (headers) != 1) {
- modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
- _("mcen_ib_select_one_message"));
+ modest_platform_information_banner ((win) ? GTK_WIDGET (win) : NULL,
+ NULL, _("mcen_ib_select_one_message"));
return;
}
/* Get the account */
account = get_account_from_header_list (headers);
-
+
+ if (!account)
+ return;
+
+ /* Get the selections, we need to get the references to the
+ rows here because the treeview/model could dissapear (the
+ user might want to select another folder)*/
+ header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+ MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
+ sel_list = gtk_tree_selection_get_selected_rows (sel, &model);
+ refs_for_headers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
+ (GDestroyNotify) gtk_tree_row_reference_free);
+
/* Look if we already have a message view for each header. If
true, then remove the header from the list of headers to
open */
+ sel_list_iter = sel_list;
not_opened_headers = tny_simple_list_new ();
- while (!tny_iterator_is_done (iter)) {
+ while (!tny_iterator_is_done (iter) && sel_list_iter) {
ModestWindow *window = NULL;
TnyHeader *header = NULL;
/* Do not open again the message and present the
window to the user */
if (found) {
- if (window)
+ if (window) {
gtk_window_present (GTK_WINDOW (window));
- else
+ } else {
/* the header has been registered already, we don't do
* anything but wait for the window to come up*/
g_debug ("header %p already registered, waiting for window", header);
+ }
} else {
+ GtkTreeRowReference *row_reference;
+
tny_list_append (not_opened_headers, G_OBJECT (header));
+ /* Create a new row reference and add it to the hash table */
+ row_reference = gtk_tree_row_reference_new (model, (GtkTreePath *) sel_list_iter->data);
+ g_hash_table_insert (refs_for_headers, header, row_reference);
}
if (header)
g_object_unref (header);
+ /* Go to next */
tny_iterator_next (iter);
+ sel_list_iter = g_list_next (sel_list_iter);
}
g_object_unref (iter);
iter = NULL;
+ g_list_foreach (sel_list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (sel_list);
/* Open each message */
- if (tny_list_get_length (not_opened_headers) == 0)
+ if (tny_list_get_length (not_opened_headers) == 0) {
+ g_hash_table_destroy (refs_for_headers);
goto cleanup;
+ }
/* If some messages would have to be downloaded, ask the user to
* make a connection. It's generally easier to do this here (in the mainloop)
uncached_msgs));
/* End if the user does not want to continue */
- if (response == GTK_RESPONSE_CANCEL)
+ if (response == GTK_RESPONSE_CANCEL) {
+ g_hash_table_destroy (refs_for_headers);
goto cleanup;
+ }
}
}
}
g_object_unref (iter_not_opened);
iter_not_opened = NULL;
+ /* Create the helper. We need to get a reference to the model
+ here because it could change while the message is readed
+ (the user could switch between folders) */
+ helper = g_slice_new (OpenMsgHelper);
+ helper->model = g_object_ref (model);
+ helper->headers = g_object_ref (not_opened_headers);
+ helper->row_refs_per_header = refs_for_headers;
+ helper->banner_info = NULL;
+
/* Connect to the account and perform */
if (uncached_msgs > 0) {
modest_platform_connect_and_perform ((GtkWindow *) win, TRUE, g_object_ref (account),
- open_msgs_performer, g_object_ref (not_opened_headers));
+ open_msgs_performer, helper);
} else {
/* Call directly the performer, do not need to connect */
- open_msgs_performer (FALSE, NULL, (GtkWindow *) win, g_object_ref (account),
- g_object_ref (not_opened_headers));
+ open_msgs_performer (FALSE, NULL, (GtkWindow *) win,
+ g_object_ref (account), helper);
}
cleanup:
/* Clean */
modest_ui_actions_on_open (GtkAction *action, ModestWindow *win)
{
TnyList *headers;
+
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * opening
+ */
+ if (modest_platform_check_memory_low (MODEST_WINDOW(win)))
+ return;
/* Get headers */
headers = get_selected_headers (win);
g_return_if_fail (MODEST_IS_WINDOW(win));
+
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * reply/forward (because it could potentially require a lot of memory */
+ if (modest_platform_check_memory_low (MODEST_WINDOW(win)))
+ return;
+
+
/* we need an account when editing */
if (!modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE)) {
if (!modest_ui_actions_run_account_setup_wizard (win))
* whether he/she wants to download them. */
if (num_of_unc_msgs) {
TnyAccount *account = get_account_from_header_list (header_list);
- continue_download = connect_to_get_msg (win, num_of_unc_msgs, account);
- g_object_unref (account);
+ if (account) {
+ continue_download = connect_to_get_msg (win, num_of_unc_msgs, account);
+ g_object_unref (account);
+ }
}
}
if (do_retrieve) {
mail_op =
modest_mail_operation_new_with_error_handling (G_OBJECT(win),
- modest_ui_actions_get_msgs_full_error_handler,
+ modest_ui_actions_disk_operations_error_handler,
NULL, NULL);
modest_mail_operation_queue_add (
modest_runtime_get_mail_operation_queue (), mail_op);
TnyAccount *account;
ModestWindow *win;
gchar *account_name;
+ gboolean poke_status;
+ gboolean interactive;
+ ModestMailOperation *mail_op;
} SendReceiveInfo;
static void
TnyAccount *account,
gpointer user_data)
{
- ModestMailOperation *mail_op;
SendReceiveInfo *info;
info = (SendReceiveInfo *) user_data;
if (err || canceled) {
+ /* In memory full conditions we could get this error here */
+ if (err && is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ }
+ if (info->mail_op) {
+ modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
+ info->mail_op);
+ }
goto clean;
}
if (info->win && MODEST_IS_MAIN_WINDOW (info->win)) {
modest_main_window_notify_send_receive_initied (MODEST_MAIN_WINDOW (info->win));
}
-
- mail_op = modest_mail_operation_new_with_error_handling ((info->win) ? G_OBJECT (info->win) : NULL,
- modest_ui_actions_send_receive_error_handler,
- NULL, NULL);
if (info->win && MODEST_IS_MAIN_WINDOW (info->win))
- g_signal_connect (G_OBJECT(mail_op), "operation-finished",
+ g_signal_connect (G_OBJECT (info->mail_op), "operation-finished",
G_CALLBACK (on_send_receive_finished),
info->win);
/* Send & receive. */
- modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
- modest_mail_operation_update_account (mail_op, info->account_name, (info->win) ? FALSE : TRUE,
+ modest_mail_operation_update_account (info->mail_op, info->account_name, info->poke_status, info->interactive,
(info->win) ? retrieve_all_messages_cb : NULL,
new_messages_arrived, info->win);
- g_object_unref (G_OBJECT (mail_op));
clean:
/* Frees */
+ if (info->mail_op)
+ g_object_unref (G_OBJECT (info->mail_op));
if (info->account_name)
g_free (info->account_name);
if (info->win)
void
modest_ui_actions_do_send_receive (const gchar *account_name,
gboolean force_connection,
+ gboolean poke_status,
+ gboolean interactive,
ModestWindow *win)
{
gchar *acc_name = NULL;
info = g_slice_new (SendReceiveInfo);
info->account_name = acc_name;
info->win = (win) ? g_object_ref (win) : NULL;
+ info->poke_status = poke_status;
+ info->interactive = interactive;
info->account = modest_tny_account_store_get_server_account (acc_store, acc_name,
TNY_ACCOUNT_TYPE_STORE);
+ /* We need to create the operation here, because otherwise it
+ could happen that the queue emits the queue-empty signal
+ while we're trying to connect the account */
+ info->mail_op = modest_mail_operation_new_with_error_handling ((info->win) ? G_OBJECT (info->win) : NULL,
+ modest_ui_actions_disk_operations_error_handler,
+ NULL, NULL);
+ modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), info->mail_op);
/* Invoke the connect and perform */
modest_platform_connect_and_perform ((win) ? GTK_WINDOW (win) : NULL,
*/
void
modest_ui_actions_do_send_receive_all (ModestWindow *win,
- gboolean force_connection)
+ gboolean force_connection,
+ gboolean poke_status,
+ gboolean interactive)
{
GSList *account_names, *iter;
iter = account_names;
while (iter) {
- modest_ui_actions_do_send_receive ((const char*) iter->data, force_connection, win);
+ modest_ui_actions_do_send_receive ((const char*) iter->data,
+ force_connection,
+ poke_status, interactive, win);
iter = g_slist_next (iter);
}
g_object_unref (folder_store);
}
- /* Refresh the active account. Force the connection if needed */
- modest_ui_actions_do_send_receive (NULL, TRUE, win);
+ /* Refresh the active account. Force the connection if needed
+ and poke the status of all folders */
+ modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, TRUE, win);
}
gtk_widget_grab_focus (GTK_WIDGET(header_view));
/* Update toolbar dimming state */
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
}
return;
}
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * activating headers
+ */
+ if (modest_platform_check_memory_low (MODEST_WINDOW(main_window)))
+ return;
+
/* headers = tny_simple_list_new (); */
/* tny_list_prepend (headers, G_OBJECT (header)); */
if (tny_folder_get_all_count (folder) == 0)
modest_main_window_set_contents_style (win,
MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
+
}
void
G_OBJECT(header_view),
MODEST_CONF_HEADER_VIEW_KEY);
} else {
- /* Update the active account */
- //modest_window_set_active_account (MODEST_WINDOW (main_window), NULL);
- /* Save only if we're seeing headers */
+ /* No need to save the header view
+ configuration for Maemo because it only
+ saves the sorting stuff and that it's
+ already being done by the sort
+ dialog. Remove it when the GNOME version
+ has the same behaviour */
+#ifdef MODEST_PLATFORM_GNOME
if (modest_main_window_get_contents_style (main_window) ==
MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS)
modest_widget_memory_save (conf, G_OBJECT (header_view),
MODEST_CONF_HEADER_VIEW_KEY);
+#endif
modest_header_view_clear (MODEST_HEADER_VIEW(header_view));
}
}
- /* Update toolbar dimming state */
+ /* Update dimming state */
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
}
void
modest_ui_actions_on_msg_attachment_clicked (ModestMsgView *msgview, TnyMimePart *mime_part,
ModestWindow *win)
-{
+{
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * viewing attachments
+ */
+ if (modest_platform_check_memory_low (MODEST_WINDOW(win)))
+ return;
+
modest_msg_view_window_view_attachment (MODEST_MSG_VIEW_WINDOW (win), mime_part);
}
edit_window = MODEST_MSG_EDIT_WINDOW (user_data);
- /* It might not be a good idea to do nothing if there was an error,
- * so let's at least show a generic error banner. */
- /* TODO error while saving attachment, show "Saving draft failed" banner */
- if (modest_mail_operation_get_error (mail_op) != NULL) {
- g_warning ("%s failed: %s\n", __FUNCTION__, (modest_mail_operation_get_error (mail_op))->message);
- modest_platform_information_banner (NULL, NULL, _("mail_ib_file_operation_failed"));
- } else {
+ /* Set draft is there was no error */
+ if (!modest_mail_operation_get_error (mail_op))
modest_msg_edit_window_set_draft (edit_window, saved_draft);
- }
+
g_object_unref(edit_window);
}
return FALSE;
}
+
+ /*
+ * djcb: if we're in low-memory state, we only allow for
+ * saving messages smaller than
+ * MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE (see modest-defs.h) this
+ * should still allow for sending anything critical...
+ */
+ if (expected_size > MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE) {
+
+ if (modest_platform_check_memory_low (MODEST_WINDOW(edit_window))) {
+ modest_msg_edit_window_free_msg_data (edit_window, data);
+ return FALSE;
+ }
+ }
+
account_name = g_strdup (data->account_name);
account_mgr = modest_runtime_get_account_mgr();
if (!account_name)
from = modest_account_mgr_get_from_string (account_mgr, account_name);
/* Create the mail operation */
- mail_operation = modest_mail_operation_new (NULL);
+ mail_operation = modest_mail_operation_new_with_error_handling (NULL, modest_ui_actions_disk_operations_error_handler,
+ NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation);
modest_mail_operation_save_to_drafts (mail_operation,
if (!modest_msg_edit_window_check_names (edit_window, TRUE))
return TRUE;
- /* FIXME: Code added just for testing. The final version will
- use the send queue provided by tinymail and some
- classifier */
MsgData *data = modest_msg_edit_window_get_msg_data (edit_window);
/* Check size */
return FALSE;
}
+
+ /*
+ * djcb: if we're in low-memory state, we only allow for sending messages
+ * smaller than MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE (see modest-defs.h)
+ * this should still allow for sending anything critical...
+ */
+ if (expected_size > MODEST_MAX_LOW_MEMORY_MESSAGE_SIZE) {
+ if (modest_platform_check_memory_low (MODEST_WINDOW(edit_window))) {
+ modest_msg_edit_window_free_msg_data (edit_window, data);
+ return FALSE;
+ }
+ }
+
+
ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr();
gchar *account_name = g_strdup (data->account_name);
if (!account_name)
g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
g_return_if_fail (GTK_IS_ACTION (action));
+
+ if (modest_platform_check_memory_low (MODEST_WINDOW(window)))
+ return;
+
if (modest_msg_edit_window_get_format (MODEST_MSG_EDIT_WINDOW(window)) == MODEST_MSG_EDIT_FORMAT_TEXT)
return;
g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
g_return_if_fail (GTK_IS_ACTION (action));
+ if (modest_platform_check_memory_low (MODEST_WINDOW(window)))
+ return;
+
modest_msg_edit_window_offer_attach_file (window);
}
GtkWindow *source_win = (GtkWindow *) modest_mail_operation_get_source (mail_op);
if (modest_mail_operation_get_error (mail_op)) {
- /* Show an error */
- modest_platform_information_banner (GTK_WIDGET (source_win), NULL,
- _("mail_in_ui_folder_create_error"));
- /* Try again */
+ /* Show an error. If there was some problem writing to
+ disk, show it, otherwise show the generic folder
+ create error. We do it here and not in an error
+ handler because the call to do_create_folder will
+ 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"));
+
+ /* Try again. Do *NOT* show any error because the mail
+ operations system will do it for us because we
+ created the mail_op with new_with_error_handler */
do_create_folder (source_win, parent_folder, (const gchar *) suggested_name);
} else {
/* the 'source_win' is either the ModestMainWindow, or the 'Move to folder'-dialog
folder_view =
get_folder_view_from_move_to_dialog (GTK_WIDGET(source_win));
- /* Select the newly created folder */
- modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
- new_folder, FALSE);
+ /* Select the newly created folder. It could happen
+ that the widget is no longer there (i.e. the window
+ has been destroyed, so we need to check this */
+ if (folder_view)
+ modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
+ new_folder, FALSE);
g_object_unref (new_folder);
}
/* Free. Note that the first time it'll be NULL so noop */
if (result == GTK_RESPONSE_ACCEPT) {
ModestMailOperation *mail_op;
- mail_op = modest_mail_operation_new (G_OBJECT(parent_window));
-
+ mail_op = modest_mail_operation_new ((GObject *) parent_window);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
modest_mail_operation_create_folder (mail_op,
TnyFolderStore *parent_folder = TNY_FOLDER_STORE (user_data);
if (canceled || err) {
+ /* In memory full conditions we could get this error here */
+ if (err && is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ }
goto frees;
}
modest_ui_actions_rename_folder_error_handler (ModestMailOperation *mail_op,
gpointer user_data)
{
- ModestMainWindow *window = MODEST_MAIN_WINDOW (user_data);
const GError *error = NULL;
const gchar *message = NULL;
message = _CS("ckdg_ib_folder_already_exists");
break;
default:
- g_warning ("%s: BUG: unexpected error:[%d]: %s", __FUNCTION__,
- error->code, error->message);
- return;
+ message = _("emev_ib_ui_imap_unable_to_rename");
}
- modest_platform_information_banner (GTK_WIDGET (window), NULL, message);
+ /* We don't set a parent for the dialog because the dialog
+ will be destroyed so the banner won't appear */
+ modest_platform_information_banner (NULL, NULL, message);
}
typedef struct {
TnyFolder *new_folder,
gpointer user_data)
{
- /* Select now */
- modest_folder_view_select_folder (MODEST_FOLDER_VIEW (user_data),
- new_folder, FALSE);
+ ModestFolderView *folder_view;
+
+ folder_view = MODEST_FOLDER_VIEW (user_data);
+ /* Note that if the rename fails new_folder will be NULL */
+ if (new_folder) {
+ modest_folder_view_select_folder (folder_view, new_folder, FALSE);
+ } else {
+ modest_folder_view_select_first_inbox_or_local (folder_view);
+ }
}
static void
GtkWidget *folder_view = NULL;
RenameFolderInfo *data = (RenameFolderInfo*)user_data;
- if (!canceled && (err == NULL) && MODEST_IS_MAIN_WINDOW(parent_window)) {
+ if (canceled || err) {
+ /* In memory full conditions we could get this error here */
+ if (err && is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ }
+ } else if (MODEST_IS_MAIN_WINDOW(parent_window)) {
folder_view = modest_main_window_get_child_widget (
MODEST_MAIN_WINDOW (parent_window),
(const gchar *) (data->new_name),
on_rename_folder_cb,
folder_view);
+ g_object_unref (mail_op);
}
- g_object_unref (mail_op);
g_free (data->new_name);
g_free (data);
}
GObject *win = modest_mail_operation_get_source (mail_op);
modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
- _("mail_in_ui_folder_delete_error"));
+ _("mail_in_ui_folder_delete_error"),
+ FALSE);
g_object_unref (win);
}
/* Show an error if it's an account */
if (!TNY_IS_FOLDER (folder)) {
modest_platform_run_information_dialog (GTK_WINDOW (main_window),
- _("mail_in_ui_folder_delete_error"));
+ _("mail_in_ui_folder_delete_error"),
+ FALSE);
g_object_unref (G_OBJECT (folder));
return;
}
if (cancel)
*cancel = FALSE;
} else {
- modest_platform_information_banner(GTK_WIDGET (dialog),
- NULL, _("mail_ib_login_cancelled"));
+ /* Set parent to NULL or the banner will disappear with its parent dialog */
+ modest_platform_information_banner(NULL, NULL, _("mail_ib_login_cancelled"));
completed = TRUE;
if (username)
*username = NULL;
if (num_of_unc_msgs) {
TnyAccount *account = get_account_from_header_list (header_list);
- continue_download = connect_to_get_msg (window, num_of_unc_msgs, account);
- g_object_unref (account);
+ if (account) {
+ continue_download = connect_to_get_msg (window, num_of_unc_msgs, account);
+ g_object_unref (account);
+ }
}
if (num_of_unc_msgs == 0 || continue_download) {
if (num_of_unc_msgs) {
TnyAccount *account = get_account_from_header_list (header_list);
- continue_download = connect_to_get_msg (window, num_of_unc_msgs, account);
- g_object_unref (account);
+ if (account) {
+ continue_download = connect_to_get_msg (window, num_of_unc_msgs, account);
+ g_object_unref (account);
+ }
}
if (num_of_unc_msgs == 0 || continue_download) {
new_sensitive = (proto != MODEST_PROTOCOL_STORE_POP);
}
g_object_unref (local_account);
+ g_object_unref (mmc_account);
}
/* Check the target folder rules */
return dialog;
}
-/*
- * Returns TRUE if at least one of the headers of the list belongs to
- * a message that has been fully retrieved.
- */
-#if 0 /* no longer in use. delete in 2007.10 */
-static gboolean
-has_retrieved_msgs (TnyList *list)
-{
- TnyIterator *iter;
- gboolean found = FALSE;
-
- iter = tny_list_create_iterator (list);
- while (!tny_iterator_is_done (iter) && !found) {
- TnyHeader *header;
- TnyHeaderFlags flags = 0;
-
- header = TNY_HEADER (tny_iterator_get_current (iter));
- if (header) {
- flags = tny_header_get_flags (header);
- if (flags & TNY_HEADER_FLAG_CACHED)
-/* if (!(flags & TNY_HEADER_FLAG_PARTIAL)) */
- found = TRUE;
-
- g_object_unref (header);
- }
-
- if (!found)
- tny_iterator_next (iter);
- }
- g_object_unref (iter);
-
- return found;
-}
-#endif /* 0 */
/*
MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view));
path = gtk_tree_row_reference_get_path (helper->reference);
+ /* We need to unselect the previous one
+ because we could be copying instead of
+ moving */
+ gtk_tree_selection_unselect_all (sel);
gtk_tree_selection_select_path (sel, path);
gtk_tree_path_free (path);
}
/* Close the "Pasting" information banner */
gtk_widget_destroy (GTK_WIDGET(helper->banner));
+ g_object_unref (helper->banner);
if (helper->reference != NULL)
gtk_tree_row_reference_free (helper->reference);
g_free (helper);
gpointer user_data)
{
ModestWindow *main_window = NULL;
- GObject *win = NULL;
/* Disable next automatic folder selection */
main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
FALSE); /* don't create */
if (main_window) {
+ GObject *win = NULL;
GtkWidget *folder_view = NULL;
folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (main_window),
modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
TNY_FOLDER (user_data), FALSE);
}
- }
-
- /* Show notification dialog */
- win = modest_mail_operation_get_source (mail_op);
- modest_platform_run_information_dialog ((GtkWindow *) win, _("mail_in_ui_folder_move_target_error"));
- if (win)
- g_object_unref (win);
-}
-
-void
-modest_ui_actions_send_receive_error_handler (ModestMailOperation *mail_op,
- gpointer user_data)
-{
- GObject *win = modest_mail_operation_get_source (mail_op);
- const GError *error = modest_mail_operation_get_error (mail_op);
- g_return_if_fail (error != NULL);
- if (error->message != NULL)
- g_printerr ("modest: %s\n", error->message);
- else
- g_printerr ("modest: unkonw error on send&receive operation");
-
- /* Show error message */
-/* if (modest_mail_operation_get_id (mail_op) == MODEST_MAIL_OPERATION_TYPE_RECEIVE) */
-/* modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL, */
-/* _CS("sfil_ib_unable_to_receive")); */
-/* else */
-/* modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL, */
-/* _CS("sfil_ib_unable_to_send")); */
- g_object_unref (win);
+ /* Show notification dialog only if the main window exists */
+ win = modest_mail_operation_get_source (mail_op);
+ modest_platform_run_information_dialog ((GtkWindow *) win,
+ _("mail_in_ui_folder_move_target_error"),
+ FALSE);
+ if (win)
+ g_object_unref (win);
+ }
}
static void
ModestMailOperation *mail_op = NULL;
modest_window_mgr_register_header (modest_runtime_get_window_mgr (), header, NULL);
mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT (win),
- modest_ui_actions_get_msgs_full_error_handler,
+ modest_ui_actions_disk_operations_error_handler,
NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
modest_mail_operation_get_msg (mail_op, header, open_msg_for_purge_cb, win);
g_object_unref (src_account);
}
+static void
+xfer_messages_error_handler (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestWindow *main_window = NULL;
+
+ /* Disable next automatic folder selection */
+ main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
+ FALSE); /* don't create */
+ if (main_window) {
+ GObject *win = modest_mail_operation_get_source (mail_op);
+ modest_platform_run_information_dialog ((GtkWindow *) win,
+ _("mail_in_ui_folder_move_target_error"),
+ FALSE);
+ if (win)
+ g_object_unref (win);
+ }
+}
/**
* Utility function that transfer messages from both the main window
const gchar *proto_str = NULL;
gboolean dst_is_pop = FALSE;
- if (canceled || err) {
- /* Show the proper error message */
- modest_ui_actions_on_account_connection_error (parent_window, account);
- g_object_unref (dst_folder);
- return;
+ if (canceled)
+ goto end;
+
+ if (err) {
+ if (is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ } else {
+ /* Show the proper error message */
+ modest_ui_actions_on_account_connection_error (parent_window, account);
+ }
+ goto end;
}
dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
headers = get_selected_headers (MODEST_WINDOW (win));
if (!headers) {
g_warning ("%s: no headers selected", __FUNCTION__);
- return;
+ goto end;
}
-
if (dst_is_pop) {
modest_platform_information_banner (GTK_WIDGET (win),
NULL,
"mail_in_ui_folder_move_targets_error",
tny_list_get_length (headers)));
g_object_unref (headers);
- return;
+ goto end;
}
MoveToHelper *helper = g_new0 (MoveToHelper, 1);
helper->banner = modest_platform_animation_banner (GTK_WIDGET (win), NULL,
_CS("ckct_nw_pasting"));
if (helper->banner != NULL) {
+ g_object_ref (helper->banner);
gtk_window_set_modal (GTK_WINDOW(helper->banner), FALSE);
gtk_widget_show (GTK_WIDGET(helper->banner));
}
ModestMailOperation *mail_op =
modest_mail_operation_new_with_error_handling (G_OBJECT(win),
- modest_ui_actions_move_folder_error_handler,
+ xfer_messages_error_handler,
NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
g_object_unref (G_OBJECT (mail_op));
g_object_unref (headers);
+ end:
g_object_unref (dst_folder);
}
helper->banner = modest_platform_animation_banner (GTK_WIDGET (parent_window), NULL,
_CS("ckct_nw_pasting"));
if (helper->banner != NULL) {
+ g_object_ref (helper->banner);
gtk_window_set_modal (GTK_WINDOW(helper->banner), FALSE);
gtk_widget_show (GTK_WIDGET(helper->banner));
}
/* modest_folder_view_select_folder (MODEST_FOLDER_VIEW(folder_view), */
/* TNY_FOLDER (src_folder), TRUE); */
+ modest_folder_view_select_folder (MODEST_FOLDER_VIEW(info->folder_view),
+ TNY_FOLDER (info->dst_folder), TRUE);
modest_mail_operation_xfer_folder (mail_op,
TNY_FOLDER (info->src_folder),
info->dst_folder,
info->delete_original,
folder_move_to_cb,
helper);
+ g_object_unref (G_OBJECT (info->src_folder));
- if (modest_mail_operation_get_status (mail_op) == MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
- modest_folder_view_select_folder (MODEST_FOLDER_VIEW(info->folder_view),
- TNY_FOLDER (info->dst_folder), TRUE);
- }
+ /* if (modest_mail_operation_get_status (mail_op) == MODEST_MAIL_OPERATION_STATUS_SUCCESS) { */
+ /* } */
/* Unref mail operation */
g_object_unref (G_OBJECT (mail_op));
- g_object_unref (G_OBJECT (info->src_folder));
g_object_unref (G_OBJECT (info->dst_folder));
g_free (user_data);
}
headers = modest_header_view_get_selected_headers(header_view);
/* Transfer the messages */
- transfer_messages_helper (GTK_WINDOW (win), TNY_FOLDER (src_folder),
- headers, TNY_FOLDER (dst_folder));
+ modest_ui_actions_transfer_messages_helper (GTK_WINDOW (win), TNY_FOLDER (src_folder),
+ headers, TNY_FOLDER (dst_folder));
g_object_unref (headers);
}
}
-static void
-transfer_messages_helper (GtkWindow *win,
- TnyFolder *src_folder,
- TnyList *headers,
- TnyFolder *dst_folder)
+void
+modest_ui_actions_transfer_messages_helper (GtkWindow *win,
+ TnyFolder *src_folder,
+ TnyList *headers,
+ TnyFolder *dst_folder)
{
gboolean need_connection = TRUE;
gboolean do_xfer = TRUE;
} else {
TnyAccount *src_account = get_account_from_folder_store (TNY_FOLDER_STORE (src_folder));
xfer_messages_performer (FALSE, NULL, GTK_WINDOW (win),
- src_account,
- g_object_ref (dst_folder));
+ src_account, g_object_ref (dst_folder));
g_object_unref (src_account);
}
}
tny_list_append (headers, G_OBJECT (header));
/* Transfer the messages */
- transfer_messages_helper (GTK_WINDOW (win), src_folder, headers,
- TNY_FOLDER (dst_folder));
+ modest_ui_actions_transfer_messages_helper (GTK_WINDOW (win), src_folder, headers,
+ TNY_FOLDER (dst_folder));
/* Frees */
g_object_unref (header);
ModestWindow *window)
{
if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
+
+ if (modest_platform_check_memory_low (MODEST_WINDOW(window)))
+ return;
+
modest_msg_view_window_save_attachments (MODEST_MSG_VIEW_WINDOW (window), NULL);
} else {
/* not supported window for this action */
TnyList *headers = TNY_LIST (user_data);
if (err || canceled) {
+ if (err && is_memory_full_error (err)) {
+ modest_platform_information_banner ((GtkWidget *) parent_window,
+ NULL, dgettext("ke-recv",
+ "cerm_device_memory_full"));
+ }
goto out;
}
/* Create mail operation */
mail_op = modest_mail_operation_new_with_error_handling ((GObject *) parent_window,
- modest_ui_actions_get_msgs_full_error_handler,
+ modest_ui_actions_disk_operations_error_handler,
NULL, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
modest_mail_operation_get_msgs_full (mail_op, headers, NULL, NULL, NULL);
{
g_return_if_fail (MODEST_IS_WINDOW (window));
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * searching
+ */
+ if (modest_platform_check_memory_low (window))
+ return;
+
modest_platform_show_search_messages (GTK_WINDOW (window));
}
modest_ui_actions_on_open_addressbook (GtkAction *action, ModestWindow *win)
{
g_return_if_fail (MODEST_IS_WINDOW (win));
+
+
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * for the addressbook
+ */
+ if (modest_platform_check_memory_low (win))
+ return;
+
+
modest_platform_show_addressbook (GTK_WINDOW (win));
}
TnyTransportAccount *server_account;
gchar *message = NULL;
- /* Don't show anything if the user cancelled something */
- if (err->code == TNY_SYSTEM_ERROR_CANCEL)
+ /* Don't show anything if the user cancelled something or the send receive request is not
+ * interactive */
+ if (err->code == TNY_SYSTEM_ERROR_CANCEL ||
+ !modest_tny_send_queue_get_requested_send_receive (MODEST_TNY_SEND_QUEUE (self)))
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));
-
- g_object_unref (server_account);
- server_account = NULL;
- }
-
- g_return_if_fail (server_name);
+ if (server_account)
+ server_name = tny_account_get_hostname (TNY_ACCOUNT (server_account));
+ else
+ g_return_if_reached ();
/* Show the appropriate message text for the GError: */
switch (err->code) {
message = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"), server_name);
break;
case TNY_SERVICE_ERROR_SEND:
- message = g_strdup (_("emev_ib_ui_smtp_send_error"));
+ message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
break;
case TNY_SERVICE_ERROR_UNAVAILABLE:
message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
default:
g_warning ("%s: unexpected ERROR %d",
__FUNCTION__, err->code);
- message = g_strdup (_("emev_ib_ui_smtp_send_error"));
+ message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
break;
}
should show the Accounts Settings dialog or the Connection
specific SMTP server window */
- modest_platform_run_information_dialog (NULL, message);
+ modest_platform_run_information_dialog (NULL, message, FALSE);
g_free (message);
+ g_object_unref (server_account);
}
void
}
if (error_note) {
- modest_platform_run_information_dialog (parent_window, error_note);
+ modest_platform_run_information_dialog (parent_window, error_note, FALSE);
g_free (error_note);
}
}
if (proto == MODEST_PROTOCOL_STORE_POP) {
msg = g_strdup (_("emev_ni_ui_pop3_msg_recv_error"));
} else if (proto == MODEST_PROTOCOL_STORE_IMAP) {
+ gchar *subject;
+ subject = tny_header_dup_subject (header);
msg = g_strdup_printf (_("emev_ni_ui_imap_message_not_available_in_server"),
- tny_header_get_subject (header));
+ subject);
+ g_free (subject);
} else {
msg = g_strdup_printf (_("mail_ni_ui_folder_get_msg_folder_error"));
}