aboutsummaryrefslogtreecommitdiffstats
path: root/composer/evolution-composer.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-02-26 00:36:59 +0800
committerDan Winship <danw@src.gnome.org>2002-02-26 00:36:59 +0800
commitc91f7c6b59f1a845bc98797c9d6bae5344136854 (patch)
tree7d4cd3bc10536913dd6359b3004fe19d47b02629 /composer/evolution-composer.c
parent387acacf48126af9f050ba2e81f5aa1ec9456ff2 (diff)
downloadgsoc2013-evolution-c91f7c6b59f1a845bc98797c9d6bae5344136854.tar.gz
gsoc2013-evolution-c91f7c6b59f1a845bc98797c9d6bae5344136854.tar.zst
gsoc2013-evolution-c91f7c6b59f1a845bc98797c9d6bae5344136854.zip
[pulled up from evolution-1-0-branch]
Mailer side of 14705. * Evolution-Composer.idl (setBody): Change setBodyText to setBody and take a MIME type as well. (show): Add an exception. * evolution-composer.c (impl_Composer_set_body, etc): Update for IDL change. While I'm here, fix this to DTRT with both plaintext and HTML bodies. (It claimed to take plain text before, but then passed it to the composer as HTML.) (impl_Composer_show): Raise an exception if setBody has been called, since the composer window will not display the real data in that case. * e-msg-composer.c (e_msg_composer_set_body): interface for impl_Composer_set_body. (build_message): If e_msg_composer_set_body has been called, use the body and MIME type supplied to it rather than the contents of the HTML editor. svn path=/trunk/; revision=15833
Diffstat (limited to 'composer/evolution-composer.c')
-rw-r--r--composer/evolution-composer.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index cf99f86e8b..1630d97ce3 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -33,6 +33,7 @@
#include <camel/camel.h>
#include "evolution-composer.h"
#include "mail/mail-config.h"
+#include "e-util/e-html-utils.h"
#define PARENT_TYPE BONOBO_OBJECT_TYPE
static BonoboObjectClass *parent_class = NULL;
@@ -115,9 +116,10 @@ impl_Composer_set_multipart_type (PortableServer_Servant servant,
}
static void
-impl_Composer_set_body_text (PortableServer_Servant servant,
- const CORBA_char *text,
- CORBA_Environment *ev)
+impl_Composer_set_body (PortableServer_Servant servant,
+ const CORBA_char *body,
+ const CORBA_char *mime_type,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EvolutionComposer *composer;
@@ -125,7 +127,14 @@ impl_Composer_set_body_text (PortableServer_Servant servant,
bonobo_object = bonobo_object_from_servant (servant);
composer = EVOLUTION_COMPOSER (bonobo_object);
- e_msg_composer_set_body_text (composer->composer, text);
+ if (!g_strcasecmp (mime_type, "text/plain")) {
+ char *htmlbody = e_text_to_html (body, E_TEXT_TO_HTML_PRE);
+ e_msg_composer_set_body_text (composer->composer, htmlbody);
+ g_free (htmlbody);
+ } else if (!g_strcasecmp (mime_type, "text/html"))
+ e_msg_composer_set_body_text (composer->composer, body);
+ else
+ e_msg_composer_set_body (composer->composer, body, mime_type);
}
static void
@@ -200,6 +209,13 @@ impl_Composer_show (PortableServer_Servant servant,
bonobo_object = bonobo_object_from_servant (servant);
composer = EVOLUTION_COMPOSER (bonobo_object);
+ if (composer->composer->mime_body) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_Composer_CannotShow,
+ NULL);
+ return;
+ }
+
gtk_widget_show (GTK_WIDGET (composer->composer));
}
@@ -224,7 +240,7 @@ evolution_composer_get_epv (void)
epv = g_new0 (POA_GNOME_Evolution_Composer__epv, 1);
epv->setHeaders = impl_Composer_set_headers;
epv->setMultipartType = impl_Composer_set_multipart_type;
- epv->setBodyText = impl_Composer_set_body_text;
+ epv->setBody = impl_Composer_set_body;
epv->attachMIME = impl_Composer_attach_MIME;
epv->attachData = impl_Composer_attach_data;
epv->show = impl_Composer_show;