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

Antonio Ospite ospite at studenti.unina.it
Tue Dec 29 09:25:50 JST 2009


On Mon, 28 Dec 2009 22:32:10 +0100
Antonio Ospite <ospite at studenti.unina.it> wrote:

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

I've thought to some improvements for the patch, comments inlined.

[...]
> 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);
> +	}
> +
> +

This conditional check could go away and use just:
menu_set_active(ifactory, "/Edit/Auto wrapping", compose->autowrap);
I am just not sure about the scope to declare ifactory in,
will you accept a simple block like:
	{
		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,
[...]
> @@ -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");
>  	}
> 

Do you think that I should save the numerical representation of
compose->autowrap instead of interpreting it?

After your comments I'll send a version 2 of the patch.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://www.sraoss.jp/pipermail/sylpheed/attachments/20091229/8e47a41e/attachment.bin 


More information about the Sylpheed mailing list