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
This commit is contained in:
Dan Winship
2000-04-23 17:15:07 +00:00
parent b33db409a6
commit 4c1c537e19
5 changed files with 90 additions and 5 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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));
}

View File

@ -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);