X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-ui-actions.c;h=7bc729e3622197c1bbec80559cca502ee1446a51;hb=58168ce48462edc4364fbac1fe73c5e5ef8c99ee;hp=5f7c8e3e6cf11a97a3f8a272bf29ddfbaa3d9794;hpb=d4537d8a01b0789310de9a11d3344147ee9691c0;p=modest diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 5f7c8e3..7bc729e 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -493,7 +493,6 @@ modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win) GtkTreeRowReference *prev_row_reference = NULL; GtkTreePath *next_path = NULL; GtkTreePath *prev_path = NULL; - GError *err = NULL; /* Find last selected row */ if (MODEST_IS_MAIN_WINDOW (win)) { @@ -555,11 +554,6 @@ modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win) if (prev_path != NULL) gtk_tree_path_free (prev_path); } - - if (err != NULL) { - printf ("DEBUG: %s: Error: code=%d, text=%s\n", __FUNCTION__, err->code, err->message); - g_error_free(err); - } /* Update toolbar dimming state */ modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window)); @@ -1002,7 +996,6 @@ open_msg_cb (ModestMailOperation *mail_op, TnyHeader *header, TnyMsg *msg, gpoi mgr = modest_runtime_get_window_mgr (); modest_window_mgr_register_window (mgr, win); g_object_unref (win); - gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW (parent_win)); gtk_widget_show_all (GTK_WIDGET(win)); } @@ -2834,7 +2827,6 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store, ModestMainWindow *main_window) { g_return_if_fail(server_account_name); - /* printf("DEBUG: %s: server_account_name=%s\n", __FUNCTION__, server_account_name); */ /* Initalize output parameters: */ if (cancel) @@ -2872,7 +2864,8 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store, modest_runtime_get_account_mgr(), server_account_name); if (!server_name) {/* This happened once, though I don't know why. murrayc. */ g_warning("%s: Could not get server name for server account '%s'", __FUNCTION__, server_account_name); - *cancel = TRUE; + if (cancel) + *cancel = TRUE; return; } @@ -3714,12 +3707,15 @@ on_move_to_dialog_folder_selection_changed (ModestFolderView* self, /* check if folder_store is an remote account */ if (TNY_IS_ACCOUNT (folder_store)) { TnyAccount *local_account = NULL; + TnyAccount *mmc_account = NULL; ModestTnyAccountStore *account_store = NULL; account_store = modest_runtime_get_account_store (); local_account = modest_tny_account_store_get_local_folders_account (account_store); + mmc_account = modest_tny_account_store_get_mmc_folders_account (account_store); - if ((gpointer) local_account != (gpointer) folder_store) { + if ((gpointer) local_account != (gpointer) folder_store && + (gpointer) mmc_account != (gpointer) folder_store) { is_local_account = FALSE; /* New button should be dimmed on remote account root */ @@ -4194,15 +4190,23 @@ modest_ui_actions_on_main_window_remove_attachments (GtkAction *action, MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW); header_list = modest_header_view_get_selected_headers (MODEST_HEADER_VIEW (header_view)); - + if (!header_list) { + g_warning ("%s: no header selected", __FUNCTION__); + return; + } + if (tny_list_get_length (header_list) == 1) { iter = tny_list_create_iterator (header_list); header = TNY_HEADER (tny_iterator_get_current (iter)); g_object_unref (iter); - } else { + } else + return; + + if (!header || !TNY_IS_HEADER(header)) { + g_warning ("%s: header is not valid", __FUNCTION__); return; } - + found = modest_window_mgr_find_registered_header (modest_runtime_get_window_mgr (), header, &msg_view_window); flags = tny_header_get_flags (header); @@ -4264,6 +4268,11 @@ modest_ui_actions_xfer_messages_from_move_to (TnyFolderStore *dst_folder, /* Get selected headers */ headers = get_selected_headers (MODEST_WINDOW (win)); + if (!headers) { + g_warning ("%s: no headers selected", __FUNCTION__); + return; + } + if (dst_is_pop) { modest_platform_information_banner (GTK_WIDGET (win), @@ -4363,6 +4372,15 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_view)); gtk_tree_selection_unselect_all (sel); + /* Let gtk events run. We need that the folder + view frees its reference to the source + folder *before* issuing the mail operation + so we need the signal handler of selection + changed to happen before the mail + operation */ + while (gtk_events_pending ()) + gtk_main_iteration (); + mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(win), modest_ui_actions_move_folder_error_handler, @@ -4419,17 +4437,27 @@ modest_ui_actions_on_msg_view_window_move_to (GtkAction *action, TnyHeader *header = NULL; TnyFolder *src_folder = NULL; TnyAccount *account = NULL; + gboolean do_xfer = FALSE; /* Create header list */ header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (win)); src_folder = TNY_FOLDER (tny_header_get_folder(header)); g_object_unref (header); - /* Transfer the message if online or confirmed by the user */ account = tny_folder_get_account (src_folder); - if (remote_folder_is_pop(TNY_FOLDER_STORE (src_folder)) || - (modest_platform_is_network_folderstore(TNY_FOLDER_STORE (src_folder)) && - connect_to_get_msg(MODEST_WINDOW (win), 1, account))) { + if (!modest_platform_is_network_folderstore(TNY_FOLDER_STORE(src_folder))) { + /* Transfer if the source folder is local */ + do_xfer = TRUE; + } else if (remote_folder_is_pop(TNY_FOLDER_STORE(src_folder))) { + /* Transfer if the source folder is POP (as it means + * that the message is already downloaded) */ + do_xfer = TRUE; + } else if (connect_to_get_msg(MODEST_WINDOW(win), 1, account)) { + /* Transfer after asking confirmation */ + do_xfer = TRUE; + } + + if (do_xfer) { modest_ui_actions_xfer_messages_from_move_to (dst_folder, MODEST_WINDOW (win)); } g_object_unref (account);