[sylpheed:33451] [RFC, PATCH] Preserve 'Auto wrapping' setting when saving to and loading from drafts.

Antonio Ospite ospite at studenti.unina.it
Tue Dec 29 06:32:10 JST 2009


This is done by introducing a new X-Sylpheed header called
X-Sylpheed-Compose-AutoWrap to store the setting boolean value in the message
source when saving to drafts. The setting and the UI status is updated on
re-edit.

Signed-off-by: Antonio Ospite <ospite at studenti.unina.it>
---

Hiro-san, could you please tell me if this approach is ok with you and if the
X header name scheme is fine? I plan to send similar patches for other compose
properties, namely: check_spell, spell_lang, use_signing, use_encryption.

Best regards,
   Antonio Ospite

 src/compose.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/compose.c b/src/compose.c
index 059bd49..e342480 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1208,6 +1208,19 @@ void compose_reedit(MsgInfo *msginfo)
 		menu_set_active(ifactory, "/Tools/Request disposition notification", TRUE);
 	}
 
+	if (compose->autowrap) {
+		GtkItemFactory *ifactory;
+
+		ifactory = gtk_item_factory_from_widget(compose->menubar);
+		menu_set_active(ifactory, "/Edit/Auto wrapping", TRUE);
+	} else {
+		GtkItemFactory *ifactory;
+
+		ifactory = gtk_item_factory_from_widget(compose->menubar);
+		menu_set_active(ifactory, "/Edit/Auto wrapping", FALSE);
+	}
+
+
 	if (prefs_common.enable_autosave && prefs_common.autosave_itv > 0)
 		compose->autosave_tag =
 			g_timeout_add(prefs_common.autosave_itv * 60 * 1000,
@@ -1577,6 +1590,7 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 				       {"REP:", NULL, FALSE},
 				       {"FWD:", NULL, FALSE},
 				       {"Disposition-Notification-To:", NULL, FALSE},
+				       {"X-Sylpheed-Compose-AutoWrap:", NULL, FALSE},
 				       {NULL, NULL, FALSE}};
 
 	enum
@@ -1585,7 +1599,8 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 		H_X_SYLPHEED_FORWARD = 1,
 		H_REP = 2,
 		H_FWD = 3,
-		H_MDN = 4
+		H_MDN = 4,
+		H_X_SYLPHEED_COMPOSE_AUTOWRAP = 5,
 	};
 
 	gchar *file;
@@ -1616,6 +1631,11 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 			compose->forward_targets = g_strdup(str);
 		} else if (hnum == H_MDN) {
 			compose->use_mdn = TRUE;
+		} else if (hnum == H_X_SYLPHEED_COMPOSE_AUTOWRAP) {
+			if (g_ascii_strcasecmp(str, "TRUE") == 0)
+				compose->autowrap = 1;
+			else
+				compose->autowrap = 0;
 		}
 	}
 
@@ -4647,6 +4667,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
 		else if (compose->forward_targets)
 			fprintf(fp, "X-Sylpheed-Forward: %s\n",
 				compose->forward_targets);
+
+		fprintf(fp, "X-Sylpheed-Compose-AutoWrap: %s\n",
+				compose->autowrap ? "TRUE": "FALSE");
 	}
 
 	/* separator between header and body */
-- 
1.6.5.7



More information about the Sylpheed mailing list