diff options
author | Sankar P <psankar@novell.com> | 2007-07-16 18:46:42 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2007-07-16 18:46:42 +0800 |
commit | d79a01ea94fba94da66278208695c8b4366a1fa7 (patch) | |
tree | c0890baee399963d67f9247b5876978eb31c5d6b /composer/e-msg-composer.c | |
parent | a86707ea39c2e71529675872757f00b49469e039 (diff) | |
download | gsoc2013-evolution-d79a01ea94fba94da66278208695c8b4366a1fa7.tar.gz gsoc2013-evolution-d79a01ea94fba94da66278208695c8b4366a1fa7.tar.zst gsoc2013-evolution-d79a01ea94fba94da66278208695c8b4366a1fa7.zip |
Provide support for keeping your signature on top while replying.
2007-07-16 Sankar P <psankar@novell.com>
Provide support for keeping your signature on top while replying.
svn path=/trunk/; revision=33808
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r-- | composer/e-msg-composer.c | 51 |
1 files changed, 47 insertions, 4 deletions
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 ("</br>%s</br>%s", tmp, text); + } else { + /* HTML Signature. Make it as part of body */ + body = g_strdup_printf ("</br>%s</br>%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); } |