} 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
} 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,
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);
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);
}
}
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 ().
*/
gtk_widget_destroy (dialog);
+
+ printf ("DEBUG: %s: cancel=%d\n", __FUNCTION__, *cancel);
}
void
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
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));
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));
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);
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;
}
}
g_object_unref (folder_store);
-
+
end:
gtk_widget_destroy (dialog);
}