X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-ui-actions.c;h=d0bb2aa2dccf8f4d1b66cc10d3d16b31dbb9ab6e;hb=8a177d0da77628cbbe0b94d4b669defd44db22ad;hp=62494ed3951c707861f72c088ab15ae13ec7ebe1;hpb=77f91326a27bdbfe55126e980ecafcc894241481;p=modest diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 62494ed..d0bb2aa 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -121,6 +121,9 @@ static void reply_forward_cb (ModestMailOperation *mail_op, static void reply_forward (ReplyForwardAction action, ModestWindow *win); +static void folder_refreshed_cb (ModestMailOperation *mail_op, + TnyFolder *folder, + gpointer user_data); static void _on_send_receive_progress_changed (ModestMailOperation *mail_op, ModestMailOperationState *state, @@ -1374,6 +1377,38 @@ modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win) /* If not, allow the user to create an account before trying to send/receive. */ if (!accounts_exist) modest_ui_actions_on_accounts (NULL, win); + + /* Refresh currently selected folder. Note that if we only + want to retrive the headers, then the refresh only will + invoke a poke_status over all folders, i.e., only the + total/unread count will be updated */ + if (MODEST_IS_MAIN_WINDOW (win)) { + GtkWidget *header_view, *folder_view; + TnyFolderStore *folder_store; + + /* Get folder and header view */ + folder_view = + modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win), + MODEST_WIDGET_TYPE_FOLDER_VIEW); + + folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view)); + + if (TNY_IS_FOLDER (folder_store)) { + header_view = + modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win), + MODEST_WIDGET_TYPE_HEADER_VIEW); + + /* We do not need to set the contents style + because it hasn't changed. We also do not + need to save the widget status. Just force + a refresh */ + modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view), + TNY_FOLDER (folder_store), + folder_refreshed_cb, + MODEST_MAIN_WINDOW (win)); + } + g_object_unref (folder_store); + } /* Refresh the active account */ modest_ui_actions_do_send_receive (NULL, win); @@ -1673,6 +1708,7 @@ modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edi gchar *account_name, *from; ModestAccountMgr *account_mgr; gchar *info_text = NULL; + TnyMsg *new_draft = NULL; g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW(edit_window)); @@ -1709,18 +1745,18 @@ modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edi mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_INFO, G_OBJECT(edit_window)); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation); - modest_mail_operation_save_to_drafts (mail_operation, - transport_account, - data->draft_msg, - from, - data->to, - data->cc, - data->bcc, - data->subject, - data->plain_body, - data->html_body, - data->attachments, - data->priority_flags); + new_draft = modest_mail_operation_save_to_drafts (mail_operation, + transport_account, + data->draft_msg, + from, + data->to, + data->cc, + data->bcc, + data->subject, + data->plain_body, + data->html_body, + data->attachments, + data->priority_flags); /* Frees */ g_free (from); g_free (account_name); @@ -1729,6 +1765,10 @@ modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edi modest_msg_edit_window_free_msg_data (edit_window, data); + modest_msg_edit_window_set_draft (edit_window, new_draft); + if (new_draft != NULL) + g_object_unref (new_draft); + info_text = g_strdup_printf (_("mail_va_saved_to_drafts"), _("mcen_me_folder_drafts")); modest_platform_information_banner (NULL, NULL, info_text); g_free (info_text);