evolution r37322 - trunk/composer



Author: mcrha
Date: Wed Feb 25 10:39:42 2009
New Revision: 37322
URL: http://svn.gnome.org/viewvc/evolution?rev=37322&view=rev

Log:
2009-02-25  Milan Crha  <mcrha redhat com>

	** Fix for bug #551470

	* e-composer-private.h:
	* e-msg-composer.c: (add_signature_delim), (get_signature_html),
	(set_editor_text): Do not force adding "-- \n" above the signature.



Modified:
   trunk/composer/ChangeLog
   trunk/composer/e-composer-private.h
   trunk/composer/e-msg-composer.c

Modified: trunk/composer/e-composer-private.h
==============================================================================
--- trunk/composer/e-composer-private.h	(original)
+++ trunk/composer/e-composer-private.h	Wed Feb 25 10:39:42 2009
@@ -58,6 +58,8 @@
 	COMPOSER_GCONF_PREFIX "/request_receipt"
 #define COMPOSER_GCONF_TOP_SIGNATURE_KEY \
 	COMPOSER_GCONF_PREFIX "/top_signature"
+#define COMPOSER_GCONF_NO_SIGNATURE_DELIM_KEY \
+	COMPOSER_GCONF_PREFIX "/no_signature_delim"
 #define COMPOSER_GCONF_SEND_HTML_KEY \
 	COMPOSER_GCONF_PREFIX "/send_html"
 #define COMPOSER_GCONF_SPELL_LANGUAGES_KEY \

Modified: trunk/composer/e-msg-composer.c
==============================================================================
--- trunk/composer/e-msg-composer.c	(original)
+++ trunk/composer/e-msg-composer.c	Wed Feb 25 10:39:42 2009
@@ -1266,6 +1266,19 @@
 	return dname;
 }
 
+static gboolean
+add_signature_delim (void)
+{
+	gboolean res;
+	GConfClient *client = gconf_client_get_default ();
+
+	res = !gconf_client_get_bool (client, COMPOSER_GCONF_NO_SIGNATURE_DELIM_KEY, NULL);
+
+	g_object_unref (client);
+
+	return res;
+}
+
 #define CONVERT_SPACES CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
 
 static gchar *
@@ -1274,7 +1287,7 @@
 	EComposerHeaderTable *table;
 	gchar *text = NULL, *html = NULL;
 	ESignature *signature;
-	gboolean format_html;
+	gboolean format_html, add_delim;
 
 	table = e_msg_composer_get_header_table (composer);
 	signature = e_composer_header_table_get_signature (table);
@@ -1282,6 +1295,8 @@
 	if (!signature)
 		return NULL;
 
+	add_delim = add_signature_delim ();
+
 	if (!signature->autogen) {
 		if (!signature->filename)
 			return NULL;
@@ -1309,7 +1324,8 @@
 		name = id->name ? camel_text_to_html (id->name, CONVERT_SPACES, 0) : NULL;
 		organization = id->organization ? camel_text_to_html (id->organization, CONVERT_SPACES, 0) : NULL;
 
-		text = g_strdup_printf ("-- <BR>%s%s%s%s%s%s%s%s",
+		text = g_strdup_printf ("%s%s%s%s%s%s%s%s%s",
+					add_delim ? "-- <BR>" : "",
 					name ? name : "",
 					(address && *address) ? " &lt;<A HREF=\"mailto:"; : "",
 					address ? address : "",
@@ -1342,7 +1358,7 @@
 					"</TD></TR></TABLE>",
 				        encoded_uid ? encoded_uid : "",
 					format_html ? "" : "<PRE>\n",
-					format_html || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
+					format_html || !add_delim || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
 					text,
 					format_html ? "" : "</PRE>\n");
 		g_free (text);
@@ -1390,7 +1406,7 @@
 		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");
+			html = add_signature_delim () ? strstr (tmp, "-- \n") : NULL;
 			if (html) {
 				/* That two consecutive - symbols followed by a space */
 				*(html+1) = ' ';



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]