body = use_signature ? g_strconcat("\n", signature, NULL) : g_strdup("");
}
- msg = modest_tny_msg_new (to_str, from_str, cc_str, bcc_str, subject_str, body, NULL, NULL);
+ msg = modest_tny_msg_new (to_str, from_str, cc_str, bcc_str, subject_str, body, NULL, NULL, NULL);
if (!msg) {
g_printerr ("modest: failed to create new msg\n");
goto cleanup;
account = g_strdup(modest_tny_account_get_parent_modest_account_name_for_server_account(
TNY_ACCOUNT(traccount)));
send_queue = modest_runtime_get_send_queue(traccount, TRUE);
- msg_id = modest_tny_send_queue_get_msg_id (header);
- status = modest_tny_send_queue_get_msg_status(send_queue, msg_id);
- /* Only open messages in outbox with the editor if they are in Failed state */
- if (status == MODEST_TNY_SEND_QUEUE_FAILED) {
- open_in_editor = TRUE;
+ if (TNY_IS_SEND_QUEUE (send_queue)) {
+ msg_id = modest_tny_send_queue_get_msg_id (header);
+ status = modest_tny_send_queue_get_msg_status(send_queue, msg_id);
+ /* Only open messages in outbox with the editor if they are in Failed state */
+ if (status == MODEST_TNY_SEND_QUEUE_FAILED) {
+ open_in_editor = TRUE;
+ }
+ g_free(msg_id);
}
- g_free(msg_id);
g_object_unref(traccount);
} else {
g_warning("Cannot get transport account for message in outbox!!");
}
}
}
-
+
/* Register the headers before actually creating the windows: */
iter_not_opened = tny_list_create_iterator (not_opened_headers);
while (!tny_iterator_is_done (iter_not_opened)) {
}
/* Show sorting dialog */
- modest_platform_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);
+ modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);
}
}
if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
return;
-/* headers = tny_simple_list_new (); */
-/* tny_list_prepend (headers, G_OBJECT (header)); */
headers = modest_header_view_get_selected_headers (header_view);
open_msgs_from_headers (headers, MODEST_WINDOW (main_window));
}
} else {
if (TNY_IS_FOLDER (folder_store) && selected) {
-
+ TnyAccount *account;
+ const gchar *account_name = NULL;
+ gboolean refresh;
+
/* Update the active account */
- TnyAccount *account = modest_tny_folder_get_account (TNY_FOLDER (folder_store));
+ account = modest_tny_folder_get_account (TNY_FOLDER (folder_store));
if (account) {
set_active_account_from_tny_account (account, MODEST_WINDOW (main_window));
+ account_name =
+ modest_tny_account_get_parent_modest_account_name_for_server_account (account);
g_object_unref (account);
account = NULL;
}
modest_main_window_set_contents_style (main_window,
MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
+ refresh = !modest_account_mgr_account_is_busy (modest_runtime_get_account_mgr (), account_name);
+
/* Set folder on header view. This function
will call tny_folder_refresh_async so we
pass a callback that will be called when
empty view if there are no messages */
modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
TNY_FOLDER (folder_store),
+ refresh,
folder_refreshed_cb,
main_window);
case MODEST_MAIL_OPERATION_ERROR_FOLDER_EXISTS:
message = _CS("ckdg_ib_folder_already_exists");
break;
+ case TNY_SERVICE_ERROR_STATE:
+ /* This means that the folder is already in use (a
+ message is opened for example */
+ message = _("emev_ni_internal_error");
+ break;
default:
message = _("emev_ib_ui_imap_unable_to_rename");
}
return;
children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
+#ifdef MODEST_PLATFORM_MAEMO
ok_button = GTK_WIDGET (children->next->next->data);
new_button = GTK_WIDGET (children->next->data);
+#else
+ ok_button = GTK_WIDGET (children->data);
+ new_button = GTK_WIDGET (children->next->next->data);
+#endif
g_list_free (children);
/* check if folder_store is an remote account */
{
GtkWidget *dialog, *scroll;
GtkWidget *new_button;
+#ifndef MODEST_PLATFORM_MAEMO
+ GtkWidget *folder_view_label;
+#endif
dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
GTK_WINDOW (win),
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
NULL);
+#ifdef MODEST_PLATFORM_MAEMO
gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT);
/* We do this manually so GTK+ does not associate a response ID for
* the button. */
new_button = gtk_button_new_from_stock (_("mcen_bd_new"));
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), new_button, FALSE, FALSE, 0);
gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_cancel"), GTK_RESPONSE_REJECT);
+#else
+ /* We do this manually so GTK+ does not associate a response ID for
+ * the button. */
+ new_button = gtk_button_new_with_label (_("mcen_ti_new_folder"));
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), new_button, FALSE, FALSE, 0);
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG (dialog)->action_area), new_button, TRUE);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 24);
+#endif
/* Create scrolled window */
scroll = gtk_scrolled_window_new (NULL, NULL);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+#ifndef MODEST_PLATFORM_MAEMO
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
+#endif
+
/* Create folder view */
*tree_view = modest_platform_create_folder_view (NULL);
scroll, TRUE, TRUE, 0);
gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
+#ifdef MODEST_PLATFORM_MAEMO
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
+#else
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
+#endif
return dialog;
}
}
static void
+move_to_helper_destroyer (gpointer user_data)
+{
+ MoveToHelper *helper = (MoveToHelper *) user_data;
+
+ /* Close the "Pasting" information banner */
+ if (helper->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);
+}
+
+static void
move_to_cb (ModestMailOperation *mail_op,
gpointer user_data)
{
}
g_object_unref (object);
}
-
- /* Close the "Pasting" information banner */
- if (helper->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);
+ /* Destroy the helper */
+ move_to_helper_destroyer (helper);
}
static void
response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win),_("mcen_nc_purge_file_text_inbox"));
if (response == GTK_RESPONSE_OK) {
- modest_platform_information_banner (NULL, NULL, _("mcen_ib_removing_attachment"));
+ GtkWidget *info;
+ info =
+ modest_platform_animation_banner (GTK_WIDGET (win), NULL, _("mcen_ib_removing_attachment"));
iter = tny_list_create_iterator (parts);
while (!tny_iterator_is_done (iter)) {
TnyMimePart *part;
g_object_unref (iter);
tny_msg_rewrite_cache (msg);
+
+ gtk_widget_destroy (info);
}
- /* } else { */
- /* This string no longer exists, refer to NB#75415 for more info */
- /* modest_platform_information_banner (NULL, NULL, _("mail_ib_attachment_already_purged")); */
}
modest_window_mgr_unregister_header (mgr, header);
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 (win)
g_object_unref (win);
}
+ move_to_helper_destroyer (user_data);
}
+typedef struct {
+ TnyFolderStore *dst_folder;
+ TnyList *headers;
+} XferMsgsHelper;
+
/**
* Utility function that transfer messages from both the main window
* and the msg view window when using the "Move to" dialog
TnyAccount *account,
gpointer user_data)
{
- TnyFolderStore *dst_folder = TNY_FOLDER_STORE (user_data);
ModestWindow *win = MODEST_WINDOW (parent_window);
- TnyList *headers = NULL;
TnyAccount *dst_account = NULL;
const gchar *proto_str = NULL;
gboolean dst_is_pop = FALSE;
+ XferMsgsHelper *helper;
+ MoveToHelper *movehelper;
+ ModestMailOperation *mail_op;
+
+ helper = (XferMsgsHelper *) user_data;
if (canceled)
goto end;
goto end;
}
- dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
+ dst_account = tny_folder_get_account (TNY_FOLDER (helper->dst_folder));
proto_str = tny_account_get_proto (dst_account);
/* tinymail will return NULL for local folders it seems */
g_object_unref (dst_account);
- /* Get selected headers */
- headers = get_selected_headers (MODEST_WINDOW (win));
- if (!headers) {
- g_warning ("%s: no headers selected", __FUNCTION__);
- goto end;
- }
-
if (dst_is_pop) {
modest_platform_information_banner (GTK_WIDGET (win),
NULL,
ngettext("mail_in_ui_folder_move_target_error",
"mail_in_ui_folder_move_targets_error",
- tny_list_get_length (headers)));
- g_object_unref (headers);
+ tny_list_get_length (helper->headers)));
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_widget_show (GTK_WIDGET(helper->banner));
+ movehelper = g_new0 (MoveToHelper, 1);
+ movehelper->banner = modest_platform_animation_banner (GTK_WIDGET (win), NULL,
+ _CS("ckct_nw_pasting"));
+ if (movehelper->banner != NULL) {
+ g_object_ref (movehelper->banner);
+ gtk_widget_show (GTK_WIDGET (movehelper->banner));
}
if (MODEST_IS_MAIN_WINDOW (win)) {
GtkWidget *header_view =
modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- helper->reference = get_next_after_selected_headers (MODEST_HEADER_VIEW (header_view));
+ movehelper->reference = get_next_after_selected_headers (MODEST_HEADER_VIEW (header_view));
}
- ModestMailOperation *mail_op =
- modest_mail_operation_new_with_error_handling (G_OBJECT(win),
- xfer_messages_error_handler,
- NULL, NULL);
+ /* Perform the mail operation */
+ mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(win),
+ xfer_messages_error_handler,
+ movehelper, NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
modest_mail_operation_xfer_msgs (mail_op,
- headers,
- TNY_FOLDER (dst_folder),
+ helper->headers,
+ TNY_FOLDER (helper->dst_folder),
TRUE,
msgs_move_to_cb,
- helper);
+ movehelper);
g_object_unref (G_OBJECT (mail_op));
- g_object_unref (headers);
end:
- g_object_unref (dst_folder);
+ g_object_unref (helper->dst_folder);
+ g_object_unref (helper->headers);
+ g_slice_free (XferMsgsHelper, helper);
}
typedef struct {
{
gboolean need_connection = TRUE;
gboolean do_xfer = TRUE;
+ XferMsgsHelper *helper;
modest_ui_actions_xfer_messages_check (win, TNY_FOLDER_STORE (src_folder),
headers, TNY_FOLDER (dst_folder),
if (!do_xfer)
return;
+ /* Create the helper */
+ helper = g_slice_new (XferMsgsHelper);
+ helper->dst_folder = g_object_ref (dst_folder);
+ helper->headers = g_object_ref (headers);
+
if (need_connection) {
DoubleConnectionInfo *connect_info = g_slice_new (DoubleConnectionInfo);
connect_info->callback = xfer_messages_performer;
connect_info->dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder));
- connect_info->data = g_object_ref (dst_folder);
+ connect_info->data = helper;
modest_platform_double_connect_and_perform(GTK_WINDOW (win), TRUE,
TNY_FOLDER_STORE (src_folder),
} 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, helper);
g_object_unref (src_account);
}
}
TnyTransportAccount *server_account;
gchar *message = NULL;
- /* Don't show anything if the user cancelled something or the send receive request is not
- * interactive */
+ /* Don't show anything if the user cancelled something or the
+ * send receive request is not interactive. Authentication
+ * errors are managed by the account store so no need to show
+ * a dialog here again */
if (err->code == TNY_SYSTEM_ERROR_CANCEL ||
+ err->code == TNY_SERVICE_ERROR_AUTHENTICATE ||
!modest_tny_send_queue_get_requested_send_receive (MODEST_TNY_SEND_QUEUE (self)))
return;
case TNY_SERVICE_ERROR_CONNECT:
message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
break;
- case TNY_SERVICE_ERROR_AUTHENTICATE:
- message = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"), server_name);
- break;
case TNY_SERVICE_ERROR_SEND:
message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
break;
message = g_strdup (dgettext("hildon-common-strings", "sfil_ib_unable_to_send"));
break;
}
-
- /* TODO if the username or the password where not defined we
- should show the Accounts Settings dialog or the Connection
- specific SMTP server window */
modest_platform_run_information_dialog (NULL, message, FALSE);
g_free (message);