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 ++++++++++++++++++-- mail/ChangeLog | 8 ++++ mail/em-composer-prefs.c | 4 ++ mail/em-composer-prefs.h | 1 + mail/mail-config.glade | 115 +++++++++++++++++++++++++++++++++++++--------- 6 files changed, 159 insertions(+), 26 deletions(-) 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); } diff --git a/mail/ChangeLog b/mail/ChangeLog index 5fa138fa4f..df105d97a1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2007-07-16 Sankar P + + * em-composer-prefs.c: (em_composer_prefs_construct): + * em-composer-prefs.h: + * mail-config.glade: + Provide support for keeping your signature on top + while replying. + 2007-07-11 Srinivasa Ragavan * em-format-html-display.c: (efhd_attachment_button): Take warning diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index b37a3ff628..deed25bd3b 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -924,6 +924,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) toggle_button_init (prefs, prefs->auto_smileys, FALSE, "/apps/evolution/mail/composer/magic_smileys"); + prefs->top_signature = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkTopSignature")); + toggle_button_init (prefs, prefs->top_signature, FALSE, + "/apps/evolution/mail/composer/top_signature"); + prefs->spell_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSpellChecking")); toggle_button_init (prefs, prefs->spell_check, FALSE, "/apps/evolution/mail/composer/inline_spelling"); diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h index ecdbb22f3f..2a2e80cbd1 100644 --- a/mail/em-composer-prefs.h +++ b/mail/em-composer-prefs.h @@ -80,6 +80,7 @@ struct _EMComposerPrefs { /* Forwards and Replies */ struct _GtkOptionMenu *forward_style; struct _GtkOptionMenu *reply_style; + struct _GtkToggleButton *top_signature; /* Keyboard Shortcuts */ struct _GtkOptionMenu *shortcuts_type; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 36defd6626..2266bb5e50 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2787,9 +2787,9 @@ For example: "Work" or "Personal" True em_account_editor_folder_selector_button_new + Select Sent Folder 0 0 - Select Sent Folder Tue, 14 Dec 2004 17:07:09 GMT @@ -2806,9 +2806,9 @@ For example: "Work" or "Personal" True em_account_editor_folder_selector_button_new + Select Drafts Folder 0 0 - Select Drafts Folder Tue, 14 Dec 2004 17:07:02 GMT @@ -4458,17 +4458,12 @@ For example: "Work" or "Personal" - + - - 0 - False - False - - + True False True @@ -4477,12 +4472,12 @@ For example: "Work" or "Personal" True GTK_RELIEF_NORMAL True - + - - 89 + + 89 36 True False @@ -4492,11 +4487,11 @@ For example: "Work" or "Personal" True GTK_RELIEF_NORMAL True - + - + 89 36 True @@ -4507,20 +4502,22 @@ For example: "Work" or "Personal" True GTK_RELIEF_NORMAL True - + - + + 0 + True + True + - 0 False True - + - @@ -7083,7 +7080,7 @@ For example: "Work" or "Personal" True False - 6 + 8 @@ -7212,14 +7209,14 @@ For example: "Work" or "Personal" True - + + True Inline original message (Outlook style) True - @@ -7403,6 +7400,80 @@ For example: "Work" or "Personal" True + + + + True + False + 2 + + + + True + False + 8 + + + + True + <b>Top Posting Option</b> (Not Recommended) + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.479999989271 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + True + _Keep Signature above the original message on replying + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + + + + 0 + True + True + + + + + 0 + True + True + + 0 -- cgit v1.2.3