Fixed a crash when moving messages
[modest] / src / modest-ui-actions.c
index 67ab33a..62fce99 100644 (file)
@@ -2036,6 +2036,12 @@ reply_forward (ReplyForwardAction action, ModestWindow *win)
 void
 modest_ui_actions_reply_calendar (ModestWindow *win, TnyList *header_pairs)
 {
+       modest_ui_actions_reply_calendar_with_subject (win, NULL, header_pairs);
+}
+
+void
+modest_ui_actions_reply_calendar_with_subject (ModestWindow *win, const gchar *custom_subject, TnyList *header_pairs)
+{
        gchar *from;
        gchar *recipient;
        gchar *signature;
@@ -2083,6 +2089,14 @@ modest_ui_actions_reply_calendar (ModestWindow *win, TnyList *header_pairs)
                goto cleanup;
        }
 
+       if (custom_subject) {
+               TnyHeader *new_msg_header;
+
+               new_msg_header = tny_msg_get_header (new_msg);
+               tny_header_set_subject (new_msg_header, custom_subject);
+               g_object_unref (new_msg_header);
+       }
+
        msg_win = (GtkWidget *) modest_msg_edit_window_new (new_msg, account_name, mailbox, FALSE);
        mgr = modest_runtime_get_window_mgr ();
        modest_window_mgr_register_window (mgr, MODEST_WINDOW (msg_win), (ModestWindow *) win);
@@ -4723,11 +4737,13 @@ create_move_to_dialog (GtkWindow *win,
                ModestAccountMgr *mgr = NULL;
                ModestAccountSettings *settings = NULL;
                ModestServerAccountSettings *store_settings = NULL;
+               ModestWindow *modest_window;
 
                modest_folder_view_set_style (MODEST_FOLDER_VIEW (tree_view),
                                              MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
 
-               active_account_name = modest_window_get_active_account (MODEST_WINDOW (win));
+               modest_window = modest_shell_peek_window (MODEST_SHELL (win));
+               active_account_name = modest_window_get_active_account (modest_window);
                mgr = modest_runtime_get_account_mgr ();
                settings = modest_account_mgr_load_account_settings (mgr, active_account_name);