[sylpheed:33557] [PATCH v2] Preserve 'Auto wrapping' setting when saving to and loading from drafts.
Antonio Ospite
ospite at studenti.unina.it
Sun Jan 17 09:49:32 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>
---
Changes since v1:
removed the if-else block in compose.c::compose_reedit, the
compose->autowrap value is now used direcly when resetting the UI
status.
Hiro-san, if you don't like the style in the first hunk then please just
use the first RFC patch I sent, the explicit form might be more
readable.
Thanks,
Antonio Ospite
src/compose.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/compose.c b/src/compose.c
index 41ab17a..eee7649 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1208,6 +1208,14 @@ 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);
+ }
+
+
if (prefs_common.enable_autosave && prefs_common.autosave_itv > 0)
compose->autosave_tag =
g_timeout_add(prefs_common.autosave_itv * 60 * 1000,
@@ -1577,6 +1585,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 +1594,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 +1626,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;
}
}
@@ -4646,6 +4661,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