[sylpheed:33621] [PATCH 1/2] Preserve spell-checking settings saving and loading drafts.

Antonio Ospite ospite at studenti.unina.it
Mon Feb 8 20:14:34 JST 2010


This is done by introducing two new X-Sylpheed headers called
X-Sylpheed-Compose-CheckSpell and X-Sylpheed-Compose-SpellLang to store
the settings values in the message source when saving to drafts.
The settings are restored and the UI status is updated on re-edit.

Signed-off-by: Antonio Ospite <ospite at studenti.unina.it>
---
 src/compose.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/compose.c b/src/compose.c
index 3613996..d2be386 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1219,6 +1219,10 @@ void compose_reedit(MsgInfo *msginfo)
 		menu_set_active(ifactory, "/Tools/Request disposition notification", TRUE);
 	}
 	menu_set_active(ifactory, "/Edit/Auto wrapping", compose->autowrap);
+#ifdef USE_GTKSPELL
+	menu_set_active(ifactory, "/Tools/Check spell", compose->check_spell);
+	compose_set_spell_lang_menu(compose);
+#endif
 
 	syl_plugin_signal_emit("compose-created", compose);
 
@@ -1600,6 +1604,8 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 				       {"FWD:", NULL, FALSE},
 				       {"Disposition-Notification-To:", NULL, FALSE},
 				       {"X-Sylpheed-Compose-AutoWrap:", NULL, FALSE},
+				       {"X-Sylpheed-Compose-CheckSpell:", NULL, FALSE},
+				       {"X-Sylpheed-Compose-SpellLang:", NULL, FALSE},
 				       {NULL, NULL, FALSE}};
 
 	enum
@@ -1609,7 +1615,9 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 		H_REP = 2,
 		H_FWD = 3,
 		H_MDN = 4,
-		H_X_SYLPHEED_COMPOSE_AUTOWRAP = 5
+		H_X_SYLPHEED_COMPOSE_AUTOWRAP = 5,
+		H_X_SYLPHEED_COMPOSE_CHECKSPELL = 6,
+		H_X_SYLPHEED_COMPOSE_SPELLLANG = 7
 	};
 
 	gchar *file;
@@ -1645,6 +1653,15 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
 				compose->autowrap = TRUE;
 			else
 				compose->autowrap = FALSE;
+#ifdef USE_GTKSPELL
+		} else if (hnum == H_X_SYLPHEED_COMPOSE_CHECKSPELL) {
+			if (g_ascii_strcasecmp(str, "TRUE") == 0)
+				compose->check_spell = TRUE;
+			else
+				compose->check_spell = FALSE;
+		} else if (hnum == H_X_SYLPHEED_COMPOSE_SPELLLANG) {
+				compose->spell_lang = g_strdup(str);
+#endif
 		}
 	}
 
@@ -4747,6 +4764,12 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
 				compose->forward_targets);
 		fprintf(fp, "X-Sylpheed-Compose-AutoWrap: %s\n",
 			compose->autowrap ? "TRUE": "FALSE");
+#ifdef USE_GTKSPELL
+		fprintf(fp, "X-Sylpheed-Compose-CheckSpell: %s\n",
+			compose->check_spell ? "TRUE": "FALSE");
+		fprintf(fp, "X-Sylpheed-Compose-SpellLang: %s\n",
+			compose->spell_lang);
+#endif
 	}
 
 	/* separator between header and body */
-- 
1.6.6.1



More information about the Sylpheed mailing list