if (modest_msg_view_window_last_message_selected (win) &&
modest_msg_view_window_first_message_selected (win)) {
modest_ui_actions_on_close_window (NULL, MODEST_WINDOW (win));
- } else if (!modest_msg_view_window_select_next_message (win)) {
+ } else if (!modest_msg_view_window_select_next_message (win) &&
+ !modest_msg_view_window_select_previous_message (win)) {
gboolean ret_value;
g_signal_emit_by_name (G_OBJECT (win), "delete-event", NULL, &ret_value);
}
{
const GError *error;
GObject *win = NULL;
- const gchar *err_msg;
+ const gchar *err_msg = (const gchar *) user_data;
win = modest_mail_operation_get_source (mail_op);
error = modest_mail_operation_get_error (mail_op);
-
- /* Select error message */
- if (error->code == MODEST_MAIL_OPERATION_ERROR_MESSAGE_SIZE_LIMIT)
- err_msg = _("emev_ni_ui_imap_msg_size_exceed_error");
- else
- err_msg = (const gchar *) user_data;
/* Show error */
modest_platform_run_information_dialog ((GtkWindow *) win, err_msg);
send&receive was invoked by the user then do not show any
visual notification, only play a sound and activate the LED
(for the Maemo version) */
- if ((new_headers != NULL) && (tny_list_get_length (new_headers) > 0))
+ if (TNY_IS_LIST(new_headers) && (tny_list_get_length (new_headers)) > 0)
modest_platform_on_new_headers_received (new_headers,
show_visual_notifications);
MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
"modest: could not find send queue for account\n");
} else {
- /* Keeep messages in outbox folder */
- tny_send_queue_cancel (send_queue, FALSE, &error);
- }
+ /* Cancel the current send */
+ tny_account_cancel (TNY_ACCOUNT (transport_account));
+
+ /* Suspend all pending messages */
+ tny_send_queue_cancel (send_queue, TNY_SEND_QUEUE_CANCEL_ACTION_SUSPEND, &error);
+ }
frees:
if (transport_account != NULL)
if ((gpointer) local_account != (gpointer) folder_store &&
(gpointer) mmc_account != (gpointer) folder_store) {
+ const char *proto_name = tny_account_get_proto (TNY_ACCOUNT (folder_store));
+ ModestTransportStoreProtocol proto = MODEST_PROTOCOL_STORE_MAILDIR;
+ if (proto_name != NULL) {
+ proto = modest_protocol_info_get_transport_store_protocol (proto_name);
+ }
is_local_account = FALSE;
/* New button should be dimmed on remote
- account root */
- new_sensitive = FALSE;
+ POP account root */
+ new_sensitive = (proto != MODEST_PROTOCOL_STORE_POP);
}
g_object_unref (local_account);
}
if (MODEST_IS_MSG_VIEW_WINDOW (object)) {
ModestMsgViewWindow *self = MODEST_MSG_VIEW_WINDOW (object);
- if (!modest_msg_view_window_select_next_message (self))
- if (!modest_msg_view_window_select_previous_message (self))
- /* No more messages to view, so close this window */
- modest_ui_actions_on_close_window (NULL, MODEST_WINDOW(self));
+ if (modest_msg_view_window_last_message_selected (self) &&
+ modest_msg_view_window_first_message_selected (self)) {
+ modest_ui_actions_on_close_window (NULL, MODEST_WINDOW (self));
+ } else if (!modest_msg_view_window_select_next_message (self) &&
+ !modest_msg_view_window_select_previous_message (self)) {
+ /* No more messages to view, so close this window */
+ modest_ui_actions_on_close_window (NULL, MODEST_WINDOW(self));
+ }
} else if (MODEST_IS_MAIN_WINDOW (object) && helper->reference != NULL) {
GtkWidget *header_view;
GtkTreePath *path;
*/
static void
xfer_messages_from_move_to_cb (gboolean canceled, GError *err,
- GtkWindow *parent_window,
- TnyAccount *account, gpointer user_data)
+ GtkWindow *parent_window,
+ TnyAccount *account, gpointer user_data)
{
TnyFolderStore *dst_folder = TNY_FOLDER_STORE (user_data);
ModestWindow *win = MODEST_WINDOW (parent_window);
g_object_unref (dst_folder);
return;
}
-
- if (!TNY_IS_FOLDER (dst_folder)) {
- modest_platform_information_banner (GTK_WIDGET (win),
- NULL,
- _CS("ckdg_ib_unable_to_move_to_current_location"));
- return;
- }
dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
proto_str = tny_account_get_proto (dst_account);
}
typedef struct {
+ TnyAccount *dst_account;
+ ModestConnectedPerformer callback;
+ gpointer data;
+} DoubleConnectionInfo;
+
+static void
+src_account_connect_performer (gboolean canceled,
+ GError *err,
+ GtkWindow *parent_window,
+ TnyAccount *src_account,
+ gpointer user_data)
+{
+ DoubleConnectionInfo *info = (DoubleConnectionInfo *) user_data;
+
+ if (canceled || err) {
+ /* If there was any error call the user callback */
+ info->callback (canceled, err, parent_window, src_account, info->data);
+ } else {
+ /* Connect the destination account */
+ modest_platform_connect_if_remote_and_perform (parent_window, TRUE,
+ TNY_FOLDER_STORE (info->dst_account),
+ info->callback, info->data);
+ }
+
+ /* Free the info object */
+ g_object_unref (info->dst_account);
+ g_slice_free (DoubleConnectionInfo, info);
+}
+
+typedef struct {
TnyFolder *src_folder;
TnyFolderStore *dst_folder;
gboolean delete_original;
/* Allow only to transfer folders to the local root folder */
if (TNY_IS_ACCOUNT (dst_folder) &&
- !MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (dst_folder)) {
- do_xfer = FALSE;
+ !MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (dst_folder)) {
+ do_xfer = FALSE;
} else if (!TNY_IS_FOLDER (src_folder)) {
g_warning ("%s: src_folder is not a TnyFolder.\n", __FUNCTION__);
do_xfer = FALSE;
}
} else if (gtk_widget_is_focus (GTK_WIDGET(header_view))) {
gboolean do_xfer = TRUE;
+
+ /* Show an error when trying to move msgs to an account */
+ if (!TNY_IS_FOLDER (dst_folder)) {
+ modest_platform_information_banner (GTK_WIDGET (win),
+ NULL,
+ _CS("ckdg_ib_unable_to_move_to_current_location"));
+ goto free;
+ }
+
/* Ask for confirmation if the source folder is remote and we're not connected */
if (!online && modest_tny_folder_store_is_remote(src_folder)) {
TnyList *headers = modest_header_view_get_selected_headers(header_view);
if (!msgs_already_deleted_from_server(headers, src_folder)) {
guint num_headers = tny_list_get_length(headers);
TnyAccount *account = get_account_from_header_list (headers);
- if (!connect_to_get_msg(MODEST_WINDOW (win), num_headers, account))
+ GtkResponseType response;
+
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),
+ ngettext("mcen_nc_get_msg",
+ "mcen_nc_get_msgs",
+ num_headers));
+ if (response == GTK_RESPONSE_CANCEL)
do_xfer = FALSE;
+
g_object_unref (account);
}
g_object_unref(headers);
}
if (do_xfer) /* Transfer messages */ {
- g_object_ref (dst_folder);
+ DoubleConnectionInfo *info = g_slice_new (DoubleConnectionInfo);
+ info->callback = xfer_messages_from_move_to_cb;
+ info->dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
+ info->data = g_object_ref (dst_folder);
+
modest_platform_connect_if_remote_and_perform(GTK_WINDOW (win), TRUE,
- TNY_FOLDER_STORE (dst_folder), xfer_messages_from_move_to_cb, dst_folder);
+ TNY_FOLDER_STORE (src_folder),
+ src_account_connect_performer,
+ info);
}
}
+ free:
if (src_folder)
g_object_unref (src_folder);
}
gchar *message = NULL;
/* Don't show anything if the user cancelled something */
- if (err->code == TNY_TRANSPORT_ACCOUNT_ERROR_SEND_USER_CANCEL)
+ if (err->code == TNY_SYSTEM_ERROR_CANCEL)
return;
/* Get the server name: */
/* Show the appropriate message text for the GError: */
switch (err->code) {
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED:
+ case TNY_SERVICE_ERROR_CONNECT:
message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE:
- message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
- break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED:
+ case TNY_SERVICE_ERROR_AUTHENTICATE:
message = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"), server_name);
break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND:
+ case TNY_SERVICE_ERROR_SEND:
message = g_strdup (_("emev_ib_ui_smtp_send_error"));
break;
default:
- g_warning ("%s: unexpected TNY_TRANSPORT_ACCOUNT_ERROR %d",
+ g_warning ("%s: unexpected ERROR %d",
__FUNCTION__, err->code);
message = g_strdup (_("emev_ib_ui_smtp_send_error"));
break;
#else
gtk_widget_queue_draw (header_view);
#endif
+
+ /* Rerun dimming rules, because the message could become deletable for example */
+ modest_window_check_dimming_rules_group (MODEST_WINDOW (main_window),
+ MODEST_DIMMING_RULES_TOOLBAR);
/* Free */
frees: