diff options
author | Radek Doulik <rodo@ximian.com> | 2004-07-28 00:52:17 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2004-07-28 00:52:17 +0800 |
commit | 34b244a0410ce78413a41c60d460d65d715281c1 (patch) | |
tree | 115a11c3fb8a5f64ffcf479373ae11b0e8f408b9 /composer | |
parent | 398fae0137f291a09e3b54549d8da4912720970f (diff) | |
download | gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar.gz gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar.bz2 gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar.lz gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar.xz gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.tar.zst gsoc2013-evolution-34b244a0410ce78413a41c60d460d65d715281c1.zip |
removed unused static variable listener_vepv
2004-07-23 Radek Doulik <rodo@ximian.com>
* listener.c: removed unused static variable listener_vepv
* added len parameter to set_editor_text,
e_msg_composer_set_body_text, e_msg_composer_set_pending_body. it
allows us to send whole buffer (even if it contains \0 in the
middle) to gtkhtml editor.
svn path=/trunk/; revision=26746
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 9 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 57 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 3 | ||||
-rw-r--r-- | composer/evolution-composer.c | 4 | ||||
-rw-r--r-- | composer/listener.c | 1 |
5 files changed, 55 insertions, 19 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index cf09a1183a..5bf57caf76 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,12 @@ +2004-07-23 Radek Doulik <rodo@ximian.com> + + * listener.c: removed unused static variable listener_vepv + + * added len parameter to set_editor_text, + e_msg_composer_set_body_text, e_msg_composer_set_pending_body. it + allows us to send whole buffer (even if it contains \0 in the + middle) to gtkhtml editor. + 2004-07-22 Radek Doulik <rodo@ximian.com> * e-msg-composer.c (set_editor_text): removed body content + diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 06280c0c13..1aa950cdfe 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1119,7 +1119,7 @@ get_signature_html (EMsgComposer *composer) } static void -set_editor_text(EMsgComposer *composer, const char *text, int set_signature, int pad_signature) +set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_signature, int pad_signature) { Bonobo_PersistStream persist; BonoboStream *stream; @@ -1135,7 +1135,10 @@ set_editor_text(EMsgComposer *composer, const char *text, int set_signature, int CORBA_exception_init (&ev); - stream = bonobo_stream_mem_create (text, strlen (text), TRUE, FALSE); + if (len == -1) + len = strlen (text); + + stream = bonobo_stream_mem_create (text, len, TRUE, FALSE); object = bonobo_object_corba_objref (BONOBO_OBJECT (stream)); Bonobo_PersistStream_load (persist, (Bonobo_Stream) object, "text/html", &ev); if (ev._major != CORBA_NO_EXCEPTION) { @@ -3378,7 +3381,7 @@ e_msg_composer_new_with_type (int type) if (new) { e_msg_composer_set_send_html (new, send_html); set_editor_signature (new); - set_editor_text (new, "", TRUE, TRUE); + set_editor_text (new, "", 0, TRUE, TRUE); } return new; @@ -3416,24 +3419,27 @@ is_special_header (const char *hdr_name) } static void -e_msg_composer_set_pending_body (EMsgComposer *composer, char *text) +e_msg_composer_set_pending_body (EMsgComposer *composer, char *text, ssize_t len) { char *old; old = g_object_get_data ((GObject *) composer, "body:text"); g_free (old); g_object_set_data ((GObject *) composer, "body:text", text); + g_object_set_data ((GObject *) composer, "body:len", GSIZE_TO_POINTER (len)); } static void e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply) { char *body; + ssize_t len; body = g_object_get_data ((GObject *) composer, "body:text"); + len = GPOINTER_TO_SIZE (g_object_get_data ((GObject *) composer, "body:len")); if (body) { if (apply) - set_editor_text (composer, body, FALSE, FALSE); + set_editor_text (composer, body, len, FALSE, FALSE); g_object_set_data ((GObject *) composer, "body:text", NULL); g_free (body); @@ -3559,7 +3565,11 @@ handle_multipart_signed (EMsgComposer *composer, CamelMultipart *multipart, int handle_multipart (composer, multipart, depth); } } else if (camel_content_type_is (content_type, "text", "*")) { - e_msg_composer_set_pending_body (composer, em_utils_part_to_html (mime_part)); + ssize_t len; + char *html; + + html = em_utils_part_to_html (mime_part, &len); + e_msg_composer_set_pending_body (composer, html, len); } else { e_msg_composer_attach (composer, mime_part); } @@ -3613,7 +3623,11 @@ handle_multipart_encrypted (EMsgComposer *composer, CamelMultipart *multipart, i handle_multipart (composer, multipart, depth); } } else if (camel_content_type_is (content_type, "text", "*")) { - e_msg_composer_set_pending_body (composer, em_utils_part_to_html (mime_part)); + ssize_t len; + char *html; + + html = em_utils_part_to_html (mime_part, &len); + e_msg_composer_set_pending_body (composer, html, len); } else { e_msg_composer_attach (composer, mime_part); } @@ -3668,8 +3682,13 @@ handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart, } } - if (text_part) - e_msg_composer_set_pending_body(composer, em_utils_part_to_html(text_part)); + if (text_part) { + ssize_t len; + char *html; + + html = em_utils_part_to_html(text_part, &len); + e_msg_composer_set_pending_body(composer, html, len); + } } static void @@ -3706,8 +3725,12 @@ handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth) handle_multipart (composer, mp, depth + 1); } } else if (depth == 0 && i == 0) { + ssize_t len; + char *html; + /* Since the first part is not multipart/alternative, then this must be the body */ - e_msg_composer_set_pending_body(composer, em_utils_part_to_html(mime_part)); + html = em_utils_part_to_html(mime_part, &len); + e_msg_composer_set_pending_body(composer, html, len); } else if (camel_mime_part_get_content_id (mime_part) || camel_mime_part_get_content_location (mime_part)) { /* special in-line attachment */ @@ -3981,7 +4004,11 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) handle_multipart (new, multipart, 0); } } else { - e_msg_composer_set_pending_body(new, em_utils_part_to_html((CamelMimePart *)message)); + ssize_t len; + char *html; + + html = em_utils_part_to_html((CamelMimePart *)message, &len); + e_msg_composer_set_pending_body(new, html, len); } /* We wait until now to set the body text because we need to ensure that @@ -4200,7 +4227,7 @@ handle_mailto (EMsgComposer *composer, const char *mailto) char *htmlbody; htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0); - set_editor_text (composer, htmlbody, FALSE, FALSE); + set_editor_text (composer, htmlbody, -1, FALSE, FALSE); g_free (htmlbody); } } @@ -4289,11 +4316,11 @@ e_msg_composer_set_headers (EMsgComposer *composer, * Loads the given HTML text into the editor. **/ void -e_msg_composer_set_body_text (EMsgComposer *composer, const char *text) +e_msg_composer_set_body_text (EMsgComposer *composer, const char *text, ssize_t len) { g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - set_editor_text (composer, text, TRUE, text == ""); + set_editor_text (composer, text, len, TRUE, text == ""); } /** @@ -4311,7 +4338,7 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body, { g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - set_editor_text (composer, _("<b>(The composer contains a non-text message body, which cannot be edited.)<b>"), FALSE, FALSE); + set_editor_text (composer, _("<b>(The composer contains a non-text message body, which cannot be edited.)<b>"), -1, FALSE, FALSE); e_msg_composer_set_send_html (composer, FALSE); disable_editor (composer); diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 649cc1be68..06e139d9b2 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -151,7 +151,8 @@ void e_msg_composer_set_headers (EMsgCo EDestination **bcc, const char *subject); void e_msg_composer_set_body_text (EMsgComposer *composer, - const char *text); + const char *text, + ssize_t len); void e_msg_composer_set_body (EMsgComposer *composer, const char *body, const char *mime_type); diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index 50bee923ee..10ed5b922e 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -161,10 +161,10 @@ impl_Composer_set_body (PortableServer_Servant servant, if (!g_ascii_strcasecmp (mime_type, "text/plain")) { char *htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0); - e_msg_composer_set_body_text (composer->composer, htmlbody); + e_msg_composer_set_body_text (composer->composer, htmlbody, -1); g_free (htmlbody); } else if (!g_ascii_strcasecmp (mime_type, "text/html")) - e_msg_composer_set_body_text (composer->composer, body); + e_msg_composer_set_body_text (composer->composer, body, -1); else e_msg_composer_set_body (composer->composer, body, mime_type); } diff --git a/composer/listener.c b/composer/listener.c index f8f8aad58d..2eb78cc8cc 100644 --- a/composer/listener.c +++ b/composer/listener.c @@ -32,7 +32,6 @@ #include "listener.h" static BonoboObjectClass *listener_parent_class; -static POA_GNOME_GtkHTML_Editor_Listener__vepv listener_vepv; inline static EditorListener * listener_from_servant (PortableServer_Servant servant) |