aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-07-28 22:38:50 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-07-28 22:38:50 +0800
commit10bfd57c379db75b8def5b6bc1590f14484de03e (patch)
tree735c02e72bd543c02345ad561a0eeec4a061e5fa /mail
parentc43feee67589f6da65f5ea8fa586d458b363d44a (diff)
downloadgsoc2013-evolution-10bfd57c379db75b8def5b6bc1590f14484de03e.tar.gz
gsoc2013-evolution-10bfd57c379db75b8def5b6bc1590f14484de03e.tar.zst
gsoc2013-evolution-10bfd57c379db75b8def5b6bc1590f14484de03e.zip
** See #61940.
2004-07-28 Not Zed <NotZed@Ximian.com> ** See #61940. * em-composer-utils.c (composer_set_body): add emformat source arg. (em_utils_reply_to_message): take source arg. Fixed callers. * em-utils.c (em_utils_message_to_html): take a source formatter argument, so we can copy/honour settings from it. (em_utils_part_to_html): similar. svn path=/trunk/; revision=26757
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/em-composer-utils.c33
-rw-r--r--mail/em-composer-utils.h3
-rw-r--r--mail/em-folder-view.c6
-rw-r--r--mail/em-popup.c6
-rw-r--r--mail/em-utils.c14
-rw-r--r--mail/em-utils.h5
7 files changed, 58 insertions, 20 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 42eba10a99..7b2da9976e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-28 Not Zed <NotZed@Ximian.com>
+
+ ** See #61940.
+
+ * em-composer-utils.c (composer_set_body): add emformat source arg.
+ (em_utils_reply_to_message): take source arg. Fixed callers.
+
+ * em-utils.c (em_utils_message_to_html): take a source formatter
+ argument, so we can copy/honour settings from it.
+ (em_utils_part_to_html): similar.
+
2004-07-27 Not Zed <NotZed@Ximian.com>
** See #57972.
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index e0991cc7fc..8e3ce70672 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -886,7 +886,7 @@ forward_non_attached (GPtrArray *messages, int style, const char *fromuri)
message = messages->pdata[i];
subject = mail_tool_generate_forward_subject (message);
- text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len);
+ text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL);
if (text) {
composer = create_new_composer (subject, fromuri);
@@ -1660,7 +1660,7 @@ attribution_format (const char *format, CamelMimeMessage *message)
}
static void
-composer_set_body (EMsgComposer *composer, CamelMimeMessage *message)
+composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *source)
{
char *text, *credits;
CamelMimePart *part;
@@ -1683,7 +1683,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message)
default:
/* do what any sane user would want when replying... */
credits = attribution_format (ATTRIBUTION, message);
- text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len);
+ text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len, source);
g_free (credits);
e_msg_composer_set_body_text(composer, text, len);
g_free (text);
@@ -1693,11 +1693,21 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message)
e_msg_composer_drop_editor_undo (composer);
}
+struct _reply_data {
+ EMFormat *source;
+ int mode;
+};
+
static void
reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
{
+ struct _reply_data *rd = user_data;
+
if (message != NULL)
- em_utils_reply_to_message(folder, uid, message, GPOINTER_TO_INT(user_data));
+ em_utils_reply_to_message(folder, uid, message, rd->mode, rd->source);
+
+ g_object_unref(rd->source);
+ g_free(rd);
}
/**
@@ -1706,6 +1716,7 @@ reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message
* @uid: optional uid
* @message: message to reply to, optional
* @mode: reply mode
+ * @source: source to inherit view settings from
*
* Creates a new composer ready to reply to @message.
*
@@ -1717,7 +1728,7 @@ reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message
* been replied to.
**/
void
-em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode)
+em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode, EMFormat *source)
{
CamelInternetAddress *to = NULL, *cc = NULL;
EMsgComposer *composer;
@@ -1726,7 +1737,13 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
guint32 flags;
if (folder && uid && message == NULL) {
- mail_get_message(folder, uid, reply_to_message, GINT_TO_POINTER(mode), mail_thread_new);
+ struct _reply_data *rd = g_malloc0(sizeof(*rd));
+
+ rd->mode = mode;
+ rd->source = source;
+ g_object_ref(rd->source);
+ mail_get_message(folder, uid, reply_to_message, rd, mail_thread_new);
+
return;
}
@@ -1764,7 +1781,7 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
if (cc != NULL)
camel_object_unref (cc);
- composer_set_body (composer, message);
+ composer_set_body (composer, message, source);
em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL);
@@ -1843,7 +1860,7 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m
if (to != NULL)
camel_object_unref (to);
- composer_set_body (composer, message);
+ composer_set_body (composer, message, NULL);
em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL);
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index df971784fd..99b1200346 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -33,6 +33,7 @@ extern "C" {
struct _CamelFolder;
struct _CamelMimeMessage;
struct _EMsgComposer;
+struct _EMFormat;
void em_composer_utils_setup_callbacks (struct _EMsgComposer *composer, struct _CamelFolder *folder, const char *uid,
guint32 flags, guint32 set, struct _CamelFolder *drafts, const char *drafts_uid);
@@ -68,7 +69,7 @@ enum {
REPLY_MODE_LIST
};
-void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode);
+void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source);
void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid);
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 85c6cd9f92..00f918ed80 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1266,15 +1266,15 @@ emfv_message_reply(EMFolderView *emfv, int mode)
((GString *)state->user_data)->str,
((GString *)state->user_data)->len,
"text/html");
- em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode);
+ em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode, NULL);
camel_object_unref(msg);
} else {
- em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode);
+ em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview);
}
html_engine_save_buffer_free(state);
} else {
- em_utils_reply_to_message(emfv->folder, emfv->list->cursor_uid, NULL, mode);
+ em_utils_reply_to_message(emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview);
}
}
diff --git a/mail/em-popup.c b/mail/em-popup.c
index d33bfe0e81..6e98f17fe8 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -772,7 +772,7 @@ emp_part_popup_reply_sender (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_SENDER);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_SENDER, NULL);
}
static void
@@ -781,7 +781,7 @@ emp_part_popup_reply_list (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_LIST);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_LIST, NULL);
}
static void
@@ -790,7 +790,7 @@ emp_part_popup_reply_all (GtkWidget *w, EMPopupTarget *t)
CamelMimeMessage *message;
message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
- em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_ALL);
+ em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_ALL, NULL);
}
static void
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 8e47f68254..f66690a052 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1365,7 +1365,7 @@ em_utils_get_proxy_uri(void)
* Return Value: The part in displayable html format.
**/
char *
-em_utils_part_to_html(CamelMimePart *part, ssize_t *len)
+em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source)
{
EMFormatQuote *emfq;
CamelStreamMem *mem;
@@ -1378,6 +1378,13 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len)
emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0);
em_format_set_session((EMFormat *)emfq, session);
+ if (source) {
+ /* copy over things we can, other things are internal, perhaps need different api than 'clone' */
+ if (source->default_charset)
+ em_format_set_default_charset((EMFormat *)emfq, source->default_charset);
+ if (source->charset)
+ em_format_set_default_charset((EMFormat *)emfq, source->charset);
+ }
em_format_part((EMFormat *) emfq, (CamelStream *) mem, part);
g_object_unref (emfq);
@@ -1395,6 +1402,7 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len)
/**
* em_utils_message_to_html:
* @message:
+ * @source:
* @credits:
* @flags: EMFormatQuote flags
*
@@ -1404,7 +1412,7 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len)
* Return value: The html version.
**/
char *
-em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len)
+em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len, EMFormat *source)
{
EMFormatQuote *emfq;
CamelStreamMem *mem;
@@ -1417,7 +1425,7 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32
emfq = em_format_quote_new(credits, (CamelStream *)mem, flags);
em_format_set_session((EMFormat *)emfq, session);
- em_format_format((EMFormat *)emfq, NULL, NULL, message);
+ em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source);
g_object_unref (emfq);
camel_stream_write ((CamelStream *) mem, "", 1);
diff --git a/mail/em-utils.h b/mail/em-utils.h
index c48db35088..f04b97c98c 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -40,6 +40,7 @@ struct _CamelMimePart;
struct _GtkSelectionData;
struct _GtkAdjustment;
struct _CamelException;
+struct _EMFormat;
gboolean em_utils_prompt_user(struct _GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...);
@@ -84,8 +85,8 @@ void em_utils_adjustment_page(struct _GtkAdjustment *adj, gboolean down);
char *em_utils_get_proxy_uri(void);
/* FIXME: should this have an override charset? */
-char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len);
-char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len);
+char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len, struct _EMFormat *source);
+char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source);
void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder);
void em_utils_empty_trash (struct _GtkWidget *parent);