diff options
Diffstat (limited to 'composer/e-composer-actions.c')
-rw-r--r-- | composer/e-composer-actions.c | 95 |
1 files changed, 14 insertions, 81 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index 61ad1e9a90..2af7a63fcd 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -22,8 +22,6 @@ #include <fcntl.h> #include <e-util/e-error.h> #include <mail/em-event.h> -#include <mail/em-format-html-print.h> -#include <mail/em-composer-utils.h> #include "misc/e-charset-picker.h" @@ -31,69 +29,13 @@ static void action_attach_cb (GtkAction *action, EMsgComposer *composer) { - EAttachmentBar *bar; - GtkWidget *dialog; - GtkWidget *option; - GSList *uris, *iter; - const gchar *disposition; - gboolean active; - gint response; - - bar = E_ATTACHMENT_BAR (composer->priv->attachment_bar); - - dialog = gtk_file_chooser_dialog_new ( - _("Insert Attachment"), - GTK_WINDOW (composer), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - _("A_ttach"), GTK_RESPONSE_OK, - NULL); - - gtk_dialog_set_default_response ( - GTK_DIALOG (dialog), GTK_RESPONSE_OK); - gtk_file_chooser_set_local_only ( - GTK_FILE_CHOOSER (dialog), FALSE); - gtk_file_chooser_set_select_multiple ( - GTK_FILE_CHOOSER (dialog), TRUE); - gtk_window_set_icon_name ( - GTK_WINDOW (dialog), "mail-message-new"); - - option = gtk_check_button_new_with_mnemonic ( - _("_Suggest automatic display of attachment")); - gtk_widget_show (option); - gtk_file_chooser_set_extra_widget ( - GTK_FILE_CHOOSER (dialog), option); - - response = gtkhtml_editor_file_chooser_dialog_run ( - GTKHTML_EDITOR (composer), dialog); - - if (response != GTK_RESPONSE_OK) - goto exit; - - uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog)); - active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (option)); - disposition = active ? "inline" : "attachment"; - - for (iter = uris; iter != NULL; iter = iter->next) { - CamelURL *url; - - url = camel_url_new (iter->data, NULL); - if (url == NULL) - continue; - - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach (bar, url->path, disposition); - else - e_attachment_bar_attach_remote_file (bar, iter->data, disposition); + EAttachmentView *view; + EAttachmentStore *store; - camel_url_free (url); - } - - g_slist_foreach (uris, (GFunc) g_free, NULL); - g_slist_free (uris); + view = e_msg_composer_get_attachment_view (composer); + store = e_attachment_view_get_store (view); -exit: - gtk_widget_destroy (dialog); + e_attachment_store_run_load_dialog (store, GTK_WINDOW (composer)); } static void @@ -106,7 +48,7 @@ action_charset_cb (GtkRadioAction *action, if (action != current) return; - charset = gtk_action_get_name (GTK_ACTION (current)); + charset = g_object_get_data (G_OBJECT (action), "charset"); g_free (composer->priv->charset); composer->priv->charset = g_strdup (charset); @@ -184,15 +126,9 @@ action_print_cb (GtkAction *action, EMsgComposer *composer) { GtkPrintOperationAction print_action; - CamelMimeMessage *message; - EMFormatHTMLPrint *efhp; print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; - message = e_msg_composer_get_message (composer, 1); - - efhp = em_format_html_print_new (NULL, print_action); - em_format_html_print_raw_message (efhp, message); - g_object_unref (efhp); + e_msg_composer_print (composer, print_action); } static void @@ -200,15 +136,9 @@ action_print_preview_cb (GtkAction *action, EMsgComposer *composer) { GtkPrintOperationAction print_action; - CamelMimeMessage *message; - EMFormatHTMLPrint *efhp; print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; - message = e_msg_composer_get_message_print (composer, 1); - - efhp = em_format_html_print_new (NULL, print_action); - em_format_html_print_raw_message (efhp, message); - g_object_unref (efhp); + e_msg_composer_print (composer, print_action); } static void @@ -339,9 +269,12 @@ action_send_options_cb (GtkAction *action, static void action_new_message_cb (GtkAction *action, - EMsgComposer *composer) + EMsgComposer *composer) { - em_utils_compose_new_message (NULL); + EMsgComposer *new_composer; + + new_composer = e_msg_composer_new (); + gtk_widget_show (GTK_WIDGET (new_composer)); } static void @@ -686,7 +619,7 @@ e_composer_actions_init (EMsgComposer *composer) gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); e_charset_add_radio_actions ( - action_group, composer->priv->charset, + action_group, "charset-", composer->priv->charset, G_CALLBACK (action_charset_cb), composer); gtk_ui_manager_insert_action_group (manager, action_group, 0); |