diff options
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 728ab77484..60c7a3dad6 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2387,137 +2387,6 @@ mail_do_view_messages (CamelFolder *folder, GPtrArray *uids, mail_operation_queue (&op_view_messages, input, TRUE); } -/* ** VIEW MESSAGE SOURCE ******************************************************* */ - -typedef struct view_message_sources_input_s { - CamelFolder *folder; - GPtrArray *uids; - FolderBrowser *fb; -} view_message_sources_input_t; - -typedef struct view_message_sources_data_s { - GPtrArray *messages; -} view_message_sources_data_t; - -static gchar * -describe_view_message_sources (gpointer in_data, gboolean gerund) -{ - view_message_sources_input_t *input = (view_message_sources_input_t *) in_data; - - if (gerund) - return g_strdup_printf - (_("Viewing message sources from folder \"%s\""), - mail_tool_get_folder_name (input->folder)); - else - return g_strdup_printf (_("View message sources from \"%s\""), - mail_tool_get_folder_name (input->folder)); -} - -static void -setup_view_message_sources (gpointer in_data, gpointer op_data, CamelException *ex) -{ - view_message_sources_input_t *input = (view_message_sources_input_t *) in_data; - - camel_object_ref (CAMEL_OBJECT (input->folder)); - gtk_object_ref (GTK_OBJECT (input->fb)); -} - -static void -do_view_message_sources (gpointer in_data, gpointer op_data, CamelException *ex) -{ - view_message_sources_input_t *input = (view_message_sources_input_t *) in_data; - view_message_sources_data_t *data = (view_message_sources_data_t *) op_data; - int i; - - data->messages = g_ptr_array_new (); - - for (i = 0; i < input->uids->len; i++) { - CamelMimeMessage *message; - - mail_op_set_message (_("Retrieving message %d of %d (uid \"%s\")"), - i + 1, input->uids->len, (char *)input->uids->pdata[i]); - - mail_tool_camel_lock_up (); - message = camel_folder_get_message (input->folder, input->uids->pdata[i], ex); - mail_tool_camel_lock_down (); - - g_ptr_array_add (data->messages, message); - } -} - -static void -cleanup_view_message_sources (gpointer in_data, gpointer op_data, - CamelException *ex) -{ - view_message_sources_input_t *input = (view_message_sources_input_t *) in_data; - view_message_sources_data_t *data = (view_message_sources_data_t *) op_data; - int i; - - for (i = 0; i < data->messages->len; i++) { - CamelMimeMessage *msg; - CamelStream *stream; - GtkWidget *dialog; - GtkWidget *source; - - if (data->messages->pdata[i] == NULL) - continue; - - msg = data->messages->pdata[i]; - - stream = camel_stream_mem_new (); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg), stream); - - dialog = gnome_dialog_new (camel_mime_message_get_subject (msg), GNOME_STOCK_BUTTON_OK, NULL); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE); - source = gtk_text_new (NULL, NULL); - gtk_text_set_editable (GTK_TEXT (source), FALSE); - gtk_text_freeze (GTK_TEXT (source)); - gtk_text_insert (GTK_TEXT (source), NULL, NULL, NULL, - CAMEL_STREAM_MEM (stream)->buffer->data, - CAMEL_STREAM_MEM (stream)->buffer->len); - gtk_text_thaw (GTK_TEXT (source)); - gtk_widget_show (source); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), source, TRUE, TRUE, 0); - - /* FIXME: this blocks, we should probably not use a run_and_close */ - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - camel_object_unref (CAMEL_OBJECT (stream)); - camel_object_unref (CAMEL_OBJECT (data->messages->pdata[i])); - g_free (input->uids->pdata[i]); - } - - g_ptr_array_free (input->uids, TRUE); - g_ptr_array_free (data->messages, TRUE); - camel_object_unref (CAMEL_OBJECT (input->folder)); - gtk_object_unref (GTK_OBJECT (input->fb)); -} - -static const mail_operation_spec op_view_message_sources = { - describe_view_message_sources, - sizeof (view_message_sources_data_t), - setup_view_message_sources, - do_view_message_sources, - cleanup_view_message_sources -}; - -void -mail_do_view_message_sources (CamelFolder *folder, GPtrArray *uids, - FolderBrowser *fb) -{ - view_message_sources_input_t *input; - - g_return_if_fail (CAMEL_IS_FOLDER (folder)); - g_return_if_fail (uids != NULL); - g_return_if_fail (IS_FOLDER_BROWSER (fb)); - - input = g_new (view_message_sources_input_t, 1); - input->folder = folder; - input->uids = uids; - input->fb = fb; - - mail_operation_queue (&op_view_message_sources, input, TRUE); -} /* ** SAVE MESSAGES ******************************************************* */ |