diff options
author | Dan Winship <danw@src.gnome.org> | 2000-04-24 01:15:07 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-04-24 01:15:07 +0800 |
commit | 4c1c537e19a6397fc4b3418e5db6eea4239ab741 (patch) | |
tree | 3402e5a878062bb5e81970729c9acc94013bc1eb | |
parent | b33db409a60f49c61d035f7d3cc2e1232ec8a186 (diff) | |
download | gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.gz gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.zst gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.zip |
rename "send" to "send_msg", to avoid name clash with the tcp function.
* folder-browser-factory.c: rename "send" to "send_msg", to avoid
name clash with the tcp function. Connect the "forward" button.
* mail-ops.c: rename "send" to "send_msg", to avoid name clash
with the tcp function. Add forward_msg function.
* mail-format.c (mail_generate_forward): support function for
forward_msg. Pretty much a big kludge right now, pending the
attachment/attachment-bar changes.
svn path=/trunk/; revision=2562
-rw-r--r-- | mail/ChangeLog | 12 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 6 | ||||
-rw-r--r-- | mail/mail-format.c | 56 | ||||
-rw-r--r-- | mail/mail-ops.c | 19 | ||||
-rw-r--r-- | mail/mail-ops.h | 2 |
5 files changed, 90 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 34da182243..ee0f155806 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2000-04-23 Dan Winship <danw@helixcode.com> + + * folder-browser-factory.c: rename "send" to "send_msg", to avoid + name clash with the tcp function. Connect the "forward" button. + + * mail-ops.c: rename "send" to "send_msg", to avoid name clash + with the tcp function. Add forward_msg function. + + * mail-format.c (mail_generate_forward): support function for + forward_msg. Pretty much a big kludge right now, pending the + attachment/attachment-bar changes. + 2000-04-22 Dan Winship <danw@helixcode.com> * mail-display.c (on_url_requested): Change cid expectations to diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index e86fddd9e9..0f438a7118 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -107,7 +107,7 @@ random_cb (GtkWidget *button, gpointer user_data) static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("New mail"), N_("Check for new mail"), fetch_mail, GNOME_STOCK_PIXMAP_MAIL_RCV), - GNOMEUIINFO_ITEM_STOCK (N_("Send"), N_("Send a new message"), send, GNOME_STOCK_PIXMAP_MAIL_SND), + GNOMEUIINFO_ITEM_STOCK (N_("Send"), N_("Send a new message"), send_msg, GNOME_STOCK_PIXMAP_MAIL_SND), GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find messages"), random_cb, GNOME_STOCK_PIXMAP_SEARCH), GNOMEUIINFO_SEPARATOR, @@ -115,7 +115,7 @@ static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("Reply"), N_("Reply to the sender of this message"), reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL), GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"), reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL), - GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), random_cb, GNOME_STOCK_PIXMAP_MAIL_FWD), + GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD), GNOMEUIINFO_SEPARATOR, @@ -139,7 +139,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih) bonobo_ui_handler_menu_new_item (uih, "/File/Mail", N_("_Mail"), NULL, -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, send, NULL); + 0, 0, send_msg, NULL); folder_browser = bonobo_control_get_widget (control); diff --git a/mail/mail-format.c b/mail/mail-format.c index 5fdf3b2d79..b5aba4ca32 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1060,3 +1060,59 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all) return composer; } + +/* This is part of the temporary kludge below. */ +#ifndef HAVE_MKSTEMP +#include <fcntl.h> +#include <sys/stat.h> +#endif + +EMsgComposer * +mail_generate_forward (CamelMimeMessage *mime_message, + gboolean forward_as_attachment, + gboolean keep_attachments) +{ + EMsgComposer *composer; + char *tmpfile; + int fd; + CamelStream *stream; + + if (!forward_as_attachment) + g_warning ("Forward as non-attachment not implemented."); + if (!keep_attachments) + g_warning ("Forwarding without attachments not implemented."); + + /* For now, we kludge by writing out a temp file. Later, + * EMsgComposer will support attaching CamelMimeParts directly, + * or something. FIXME. + */ + tmpfile = g_strdup ("/tmp/evolution-kludge-XXXX"); +#ifdef HAVE_MKSTEMP + fd = mkstemp (tmpfile); +#else + if (mktemp (tmpfile)) { + fd = open (tmpfile, O_RDWR | O_CREAT | O_EXCL, + S_IRUSR | S_IWUSR); + } else + fd = -1; +#endif + if (fd == -1) { + g_warning ("Couldn't create temp file for forwarding"); + g_free (tmpfile); + return NULL; + } + + stream = camel_stream_fs_new_with_fd (fd); + camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), + stream); + camel_stream_close (stream); + + composer = E_MSG_COMPOSER (e_msg_composer_new ()); + e_msg_composer_attachment_bar_attach (composer->attachment_bar, + tmpfile); + g_free (tmpfile); + + /* FIXME: should we default a subject? */ + + return composer; +} diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 731770c0c2..81724c4f43 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -275,7 +275,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data) void -send (GtkWidget *widget, gpointer user_data) +send_msg (GtkWidget *widget, gpointer user_data) { GtkWidget *composer; @@ -312,3 +312,20 @@ reply_to_all (GtkWidget *button, gpointer user_data) { reply (FOLDER_BROWSER (user_data), TRUE); } + + +void +forward_msg (GtkWidget *button, gpointer user_data) +{ + FolderBrowser *fb; + EMsgComposer *composer; + + fb = FOLDER_BROWSER (user_data); + composer = mail_generate_forward (fb->mail_display->current_message, + TRUE, TRUE); + + gtk_signal_connect (GTK_OBJECT (composer), "send", + GTK_SIGNAL_FUNC (composer_send_cb), NULL); + + gtk_widget_show (GTK_WIDGET (composer)); +} diff --git a/mail/mail-ops.h b/mail/mail-ops.h index f7f3d3e0c7..86b6ac81ff 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -1,5 +1,5 @@ void fetch_mail (GtkWidget *button, gpointer user_data); -void send (GtkWidget *button, gpointer user_data); +void send_msg (GtkWidget *button, gpointer user_data); void forward_msg (GtkWidget *button, gpointer user_data); void reply_to_sender (GtkWidget *button, gpointer user_data); void reply_to_all (GtkWidget *button, gpointer user_data); |