[sylpheed:33592] [PATCH v3] Preserve 'Auto wrapping' setting when saving to and loading from drafts.

Antonio Ospite ospite at studenti.unina.it
Wed Jan 27 01:50:48 JST 2010


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>
---
Hi,

this is like v2 but rebased on latest SVN, where the previous version does not
apply cleanly because of the syl_plugin_signal_emit() call in
compose.c::compose_reedit()

Hiro-san, are you going to apply this one? If so I am going to work on other
similar (preserve-settings-in-drafts) changes.

Thanks again,
   Antonio Ospite
   http://ao2.it

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

diff --git a/src/compose.c b/src/compose.c
index e538b3f..0a97a79 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1220,6 +1220,13 @@ void compose_reedit(MsgInfo *msginfo)
 		menu_set_active(ifactory, "/Tools/Request disposition notification", TRUE);
 	}
 
+	{
+		GtkItemFactory *ifactory;
+
+		ifactory = gtk_item_factory_from_widget(compose->menubar);
+		menu_set_active(ifactory, "/Edit/Auto wrapping", compose->autowrap);
+	}
+
 	syl_plugin_signal_emit("compose-created", compose);
 
 	if (prefs_common.enable_autosave && prefs_common.autosave_itv > 0)
@@ -1599,6 +1606,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
@@ -1607,7 +1615,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;
@@ -1638,6 +1647,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;
 		}
 	}
 
@@ -4738,6 +4752,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.6



More information about the Sylpheed mailing list