From e70b51e165105320dc0131e239d195f1434367e4 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Fri, 16 Jan 2009 16:44:11 +0000 Subject: [PATCH] * Fixes NB#97935, crash when moving messages in viewer window * Fixes NB#98315, do not show the "Pasting " banner pmo-trunk-r7165 --- src/hildon2/modest-platform.c | 7 +++- src/modest-ui-actions.c | 81 ++++++++++++++++++-------------------- src/widgets/modest-folder-view.c | 2 +- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/src/hildon2/modest-platform.c b/src/hildon2/modest-platform.c index c909a50..890233d 100644 --- a/src/hildon2/modest-platform.c +++ b/src/hildon2/modest-platform.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -695,7 +696,8 @@ folder_chooser_dialog_run (ModestFolderView *original) modest_folder_view_set_filter (MODEST_FOLDER_VIEW (folder_view), MODEST_FOLDER_VIEW_FILTER_CAN_HAVE_FOLDERS); - modest_folder_view_copy_model (MODEST_FOLDER_VIEW (original), MODEST_FOLDER_VIEW (folder_view)); + modest_folder_view_copy_model (MODEST_FOLDER_VIEW (original), + MODEST_FOLDER_VIEW (folder_view)); visible_id = modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(original)); @@ -2436,6 +2438,9 @@ modest_platform_create_move_to_dialog (GtkWindow *parent_window, G_CALLBACK (on_move_to_dialog_folder_activated), dialog); + tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (*folder_view), + (TnyAccountStore *) modest_runtime_get_account_store ()); + /* Create pannable and add it to the dialog */ folder_view_container = hildon_pannable_area_new (); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container); diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index c4bf52d..bfbe71f 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -5014,40 +5014,42 @@ move_to_cb (ModestMailOperation *mail_op, gpointer user_data) { MoveToHelper *helper = (MoveToHelper *) user_data; + GObject *object = modest_mail_operation_get_source (mail_op); /* Note that the operation could have failed, in that case do nothing */ - if (modest_mail_operation_get_status (mail_op) == - MODEST_MAIL_OPERATION_STATUS_SUCCESS) { + if (modest_mail_operation_get_status (mail_op) != + MODEST_MAIL_OPERATION_STATUS_SUCCESS) + goto frees; - GObject *object = modest_mail_operation_get_source (mail_op); - if (MODEST_IS_MSG_VIEW_WINDOW (object)) { - ModestMsgViewWindow *self = MODEST_MSG_VIEW_WINDOW (object); + if (MODEST_IS_MSG_VIEW_WINDOW (object)) { + ModestMsgViewWindow *self = MODEST_MSG_VIEW_WINDOW (object); - 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) && - gtk_tree_row_reference_valid (helper->reference)) { - GtkWidget *header_view; - GtkTreePath *path; - GtkTreeSelection *sel; - - header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(object), - 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); + 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)); } - g_object_unref (object); - } + } else if (MODEST_IS_MAIN_WINDOW (object) && + gtk_tree_row_reference_valid (helper->reference)) { + GtkWidget *header_view; + GtkTreePath *path; + GtkTreeSelection *sel; + + header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(object), + 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); + } + g_object_unref (object); + + frees: /* Destroy the helper */ move_to_helper_destroyer (helper); } @@ -5340,20 +5342,12 @@ 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); - } - move_to_helper_destroyer (user_data); + 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); } typedef struct { @@ -5407,12 +5401,15 @@ xfer_messages_performer (gboolean canceled, } movehelper = g_new0 (MoveToHelper, 1); + +#ifndef MODEST_TOOLKIT_HILDON2 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)); } +#endif if (MODEST_IS_MAIN_WINDOW (win)) { GtkWidget *header_view = diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index 64f9379..ca067fa 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -1907,7 +1907,7 @@ modest_folder_view_update_model (ModestFolderView *self, TnyAccount *account; ModestTnyAccountStore *acc_store; - acc_store = MODEST_TNY_ACCOUNT_STORE (priv->account_store); + acc_store = modest_runtime_get_account_store (); account = modest_tny_account_store_get_local_folders_account (acc_store); if (g_signal_handler_is_connected (account, -- 1.7.9.5