X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-ui-actions.c;h=3445e47c85e1926affee6a0927ca89f61fb7dd34;hb=ab71824e3c4e16f5a6371895236f9d4055d21eca;hp=9dfd9ee57f69090761b8ab152c18ac9ae329fbb4;hpb=17c6bcbe28291b383c07fae265010f9bdb644844;p=modest diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 9dfd9ee..3445e47 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -157,17 +157,16 @@ get_selected_headers (ModestWindow *win) } else if (MODEST_IS_MSG_VIEW_WINDOW (win)) { /* for MsgViewWindows, we simply return a list with one element */ - TnyMsg *msg; TnyHeader *header; TnyList *list = NULL; - msg = modest_msg_view_window_get_message (MODEST_MSG_VIEW_WINDOW(win)); - if (msg) { - header = tny_msg_get_header (msg); + header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (win)); + if (header != NULL) { list = tny_simple_list_new (); tny_list_prepend (list, G_OBJECT(header)); g_object_unref (G_OBJECT(header)); } + return list; } else @@ -722,7 +721,7 @@ reply_forward (ReplyForwardAction action, ModestWindow *win) } else reply_forward_func (G_OBJECT(win), g_object_ref (msg), rf_helper); } else { - + /* Retrieve messages */ mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win)); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); modest_mail_operation_get_msgs_full (mail_op, @@ -1074,14 +1073,18 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view, conf = modest_runtime_get_conf (); - if (TNY_IS_FOLDER (folder_store)) { - - if (selected) { + if (TNY_IS_ACCOUNT (folder_store)) { + /* Update active account */ + set_active_account_from_tny_account (TNY_ACCOUNT (folder_store), MODEST_WINDOW (main_window)); + /* Show account details */ + modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS); + } else { + if (TNY_IS_FOLDER (folder_store) && selected) { /* Update the active account */ account = tny_folder_get_account (TNY_FOLDER (folder_store)); set_active_account_from_tny_account (account, MODEST_WINDOW (main_window)); g_object_unref (account); - + /* Set folder on header view */ modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS); @@ -1096,11 +1099,6 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view, modest_widget_memory_save (conf, G_OBJECT (header_view), MODEST_CONF_HEADER_VIEW_KEY); modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view), NULL); } - } else if (TNY_IS_ACCOUNT (folder_store)) { - /* Update active account */ - set_active_account_from_tny_account (TNY_ACCOUNT (folder_store), MODEST_WINDOW (main_window)); - /* Show account details */ - modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS); } } @@ -1689,6 +1687,13 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store, g_return_if_fail(server_account_name); /* printf("DEBUG: %s: server_account_name=%s\n", __FUNCTION__, server_account_name); */ + /* Initalize output parameters: */ + if (cancel) + *cancel = FALSE; + + if (remember) + *remember = TRUE; + #ifdef MODEST_PLATFORM_MAEMO /* Maemo uses a different (awkward) button order, * It should probably just use gtk_alternative_dialog_button_order (). @@ -1844,6 +1849,8 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store, */ gtk_widget_destroy (dialog); + + printf ("DEBUG: %s: cancel=%d\n", __FUNCTION__, *cancel); } void @@ -2367,6 +2374,19 @@ tranasfer_msgs_from_viewer_cb (const GObject *object, gpointer user_data) g_return_if_fail (found); } +static void +move_to_error_checking (const GObject *obj, gpointer user_data) +{ + ModestWindow *win = NULL; + + g_return_if_fail (MODEST_IS_WINDOW (obj)); + win = MODEST_WINDOW (obj); + + /* TODO: show error message */ +/* modest_platform_run_information_dialog (GTK_WINDOW (win), */ +/* _("mail_in_ui_folder_move_target_error")); */ +} + /* * UI handler for the "Move to" action when invoked from the * ModestMainWindow @@ -2375,9 +2395,10 @@ static void modest_ui_actions_on_main_window_move_to (GtkAction *action, ModestMainWindow *win) { - GtkWidget *dialog, *folder_view, *tree_view = NULL; + GtkWidget *dialog = NULL, *folder_view = NULL, *tree_view = NULL; + GtkWidget *header_view = NULL; gint result; - TnyFolderStore *folder_store; + TnyFolderStore *folder_store = NULL; ModestMailOperation *mail_op = NULL; g_return_if_fail (MODEST_IS_MAIN_WINDOW (win)); @@ -2386,6 +2407,10 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, folder_view = modest_main_window_get_child_widget (win, MODEST_WIDGET_TYPE_FOLDER_VIEW); + /* Get header view */ + header_view = modest_main_window_get_child_widget (win, + MODEST_WIDGET_TYPE_HEADER_VIEW); + /* Create and run the dialog */ dialog = create_move_to_dialog (MODEST_WINDOW (win), folder_view, &tree_view); result = gtk_dialog_run (GTK_DIALOG(dialog)); @@ -2405,8 +2430,13 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, TnyFolderStore *src_folder; src_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view)); + /* Clean folder on header view before moving it */ + modest_header_view_set_folder (MODEST_HEADER_VIEW (header_view), NULL); + if (TNY_IS_FOLDER (src_folder)) { - mail_op = modest_mail_operation_new (MODEST_MAIL_OPERATION_ID_RECEIVE, G_OBJECT(win)); + mail_op = modest_mail_operation_new_with_error_handling (MODEST_MAIL_OPERATION_ID_RECEIVE, + G_OBJECT(win), + move_to_error_checking); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -2415,14 +2445,12 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, folder_store, TRUE); g_object_unref (G_OBJECT (mail_op)); + } /* Frees */ g_object_unref (G_OBJECT (src_folder)); } else { - GtkWidget *header_view; - header_view = modest_main_window_get_child_widget (win, - MODEST_WIDGET_TYPE_HEADER_VIEW); if (gtk_widget_is_focus (header_view)) { TnyList *headers; gint response; @@ -2452,7 +2480,7 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, } } g_object_unref (folder_store); - + end: gtk_widget_destroy (dialog); }