From d79a01ea94fba94da66278208695c8b4366a1fa7 Mon Sep 17 00:00:00 2001 From: Sankar P Date: Mon, 16 Jul 2007 10:46:42 +0000 Subject: Provide support for keeping your signature on top while replying. 2007-07-16 Sankar P Provide support for keeping your signature on top while replying. svn path=/trunk/; revision=33808 --- composer/ChangeLog | 6 ++++++ composer/e-msg-composer.c | 51 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index f4294aa9d7..1a99398cb8 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2007-07-16 Sankar P + + * e-msg-composer.c: (set_editor_text): + Provide option to keep signature on top, + while replying. Outlook users need it. + 2007-07-09 Srinivasa Ragavan diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index fcfd767f39..adec84e35f 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1259,17 +1259,60 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s BonoboStream *stream; CORBA_Environment ev; Bonobo_Unknown object; + gboolean reply_signature_on_top; + char *body = NULL, *html = NULL; + GConfClient *gconf; g_return_if_fail (p->persist_stream_interface != CORBA_OBJECT_NIL); persist = p->persist_stream_interface; CORBA_exception_init (&ev); + + gconf = gconf_client_get_default (); + + /* + + Keeping Signatures in the beginning of composer + ------------------------------------------------ + + Purists are gonna blast me for this. + But there are so many people (read Outlook users) who want this. + And Evo is an exchange-client, Outlook-replacement etc. + So Here it goes :( + + -- Sankar + + */ + + reply_signature_on_top = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/top_signature", NULL); - if (len == -1) - len = strlen (text); + g_object_unref (gconf); + + if (set_signature && reply_signature_on_top) { + char *tmp = NULL; + tmp = get_signature_html (composer); + if (tmp) { + /* Minimizing the damage. Make it just a part of the body instead of a signature */ + html = strstr (tmp, "-- \n"); + if (html) { + /* That two consecutive - symbols followed by a space */ + *(html+1) = ' '; + body = g_strdup_printf ("
%s
%s", tmp, text); + } else { + /* HTML Signature. Make it as part of body */ + body = g_strdup_printf ("
%s
%s", tmp, text); + } + } + } else { + body = g_strdup(text); + } + + if (body) { + len = strlen (body); + } - stream = bonobo_stream_mem_create (text, len, TRUE, FALSE); + stream = bonobo_stream_mem_create (body, 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) { @@ -1283,7 +1326,7 @@ set_editor_text(EMsgComposer *composer, const char *text, ssize_t len, int set_s bonobo_object_unref (BONOBO_OBJECT (stream)); - if (set_signature) + if (set_signature && !reply_signature_on_top) e_msg_composer_show_sig_file (composer); } -- cgit