From aadeb422d2dca792606159a24de45ce074170e0d Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 29 Jan 2004 06:27:52 +0000 Subject: reverted radek's patch below, it was already fixed (#53176). Changed the 2004-01-29 Not Zed * e-msg-composer.c (e_msg_composer_new_with_type): reverted radek's patch below, it was already fixed (#53176). Changed the init order though, set_editor_signature only sets the current one, it doen'st insert it. ** See bug #53506. * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_post_to_list): use a GString to build the result. (e_msg_composer_hdrs_set_post_to_base): same here. (e_msg_composer_hdrs_set_post_to_base): dont bother copying the post_to string. (e_msg_composer_hdrs_get_post_to): change the relative-url test to ":/" rather than "://", so that mbox url's work. svn path=/trunk/; revision=24512 --- composer/ChangeLog | 17 ++++++++++++ composer/e-msg-composer-hdrs.c | 59 ++++++++++++++++++++---------------------- composer/e-msg-composer.c | 2 +- 3 files changed, 46 insertions(+), 32 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index b2efb9af84..e094cfc06a 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,20 @@ +2004-01-29 Not Zed + + * e-msg-composer.c (e_msg_composer_new_with_type): reverted + radek's patch below, it was already fixed (#53176). Changed the + init order though, set_editor_signature only sets the current one, + it doen'st insert it. + + ** See bug #53506. + + * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_post_to_list): + use a GString to build the result. + (e_msg_composer_hdrs_set_post_to_base): same here. + (e_msg_composer_hdrs_set_post_to_base): dont bother copying the + post_to string. + (e_msg_composer_hdrs_get_post_to): change the relative-url test to + ":/" rather than "://", so that mbox url's work. + 2004-01-27 Radek Doulik * e-msg-composer.c (e_msg_composer_new_with_type): set body text diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 23a77f9a4e..4c9b473954 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -1238,69 +1238,65 @@ folder_name_to_string (EMsgComposerHdrs *hdrs, const char *uri) void e_msg_composer_hdrs_set_post_to_list (EMsgComposerHdrs *hdrs, GList *urls) { - /* compile the name */ - char *caption, *tmp, *tmp2; + GString *caption; + char *tmp; gboolean post_custom; if (hdrs->priv->post_to.entry == NULL) return; - - caption = g_strdup (""); - + + caption = g_string_new(""); while (urls) { - tmp = folder_name_to_string (hdrs, (char *)urls->data); + tmp = folder_name_to_string(hdrs, (char *)urls->data); if (tmp) { - tmp2 = g_strconcat (caption, ", ", tmp, NULL); - g_free (caption); - caption = tmp2; - g_free (tmp); + if (caption->len) + g_string_append(caption, ", "); + g_string_append(caption, tmp); } urls = g_list_next (urls); } post_custom = hdrs->priv->post_custom; - gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption[0] ? caption + 2 : ""); + gtk_entry_set_text(GTK_ENTRY(hdrs->priv->post_to.entry), caption->str); hdrs->priv->post_custom = post_custom; - g_free (caption); + + g_string_free(caption, TRUE); } void -e_msg_composer_hdrs_set_post_to_base (EMsgComposerHdrs *hdrs, - const char *base, const char *post_to) +e_msg_composer_hdrs_set_post_to_base (EMsgComposerHdrs *hdrs, const char *base, const char *post_to) { GList *lst, *curlist; - char *hdr_copy = g_strdup (post_to), *caption, *tmp, *tmp2; + char *tmp, *tmp2; gboolean post_custom; + GString *caption; /* split to newsgroup names */ - lst = newsgroups_list_split (hdr_copy); + lst = newsgroups_list_split(post_to); curlist = lst; - /* compile the name */ - caption = g_strdup (""); - + caption = g_string_new(""); while (curlist) { + /* FIXME: this doens't handle all folder names properly */ tmp2 = g_strdup_printf ("%s/%s", base, (char *)curlist->data); tmp = folder_name_to_string (hdrs, tmp2); g_free (tmp2); if (tmp) { - tmp2 = g_strconcat (caption, ", ", tmp, NULL); - g_free (caption); - caption = tmp2; - g_free (tmp); + if (caption->len) + g_string_append(caption, ", "); + g_string_append(caption, tmp); } - curlist = g_list_next (curlist); + curlist = g_list_next(curlist); } post_custom = hdrs->priv->post_custom; - gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption[0] ? caption + 2 : ""); + gtk_entry_set_text(GTK_ENTRY(hdrs->priv->post_to.entry), caption->str); hdrs->priv->post_custom = post_custom; - g_free (caption); - - g_list_foreach (lst, (GFunc) g_free, NULL); - g_list_free (lst); - g_free (hdr_copy); + + g_string_free(caption, TRUE); + g_list_foreach(lst, (GFunc)g_free, NULL); + g_list_free(lst); } void @@ -1472,7 +1468,8 @@ e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs) cur = uris; while (cur) { - if (strstr ((char *) cur->data, "://") == NULL) { + /* FIXME: this is a bit of a hack, should use camelurl's etc */ + if (strstr ((char *) cur->data, ":/") == NULL) { /* relative folder name: convert to absolute */ if (!storeurl) storeurl = get_account_store_url (hdrs); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 5c4a22e0d6..487d8c608e 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3276,7 +3276,7 @@ e_msg_composer_new_with_type (int type) if (new) { e_msg_composer_set_send_html (new, send_html); set_editor_signature (new); - e_msg_composer_set_body_text (new, ""); + set_editor_text (new, ""); } return new; -- cgit v1.2.3