aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer-hdrs.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-03-13 08:05:02 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-03-13 08:05:02 +0800
commitb1f9622c1aadb6483aacde2bf3548158932f512a (patch)
tree0d63ac365abd1dee28b68d4a65294f41b683cb36 /composer/e-msg-composer-hdrs.c
parent8ea5c96560b29591eede8258b48b74619ab00fb8 (diff)
downloadgsoc2013-evolution-b1f9622c1aadb6483aacde2bf3548158932f512a.tar.gz
gsoc2013-evolution-b1f9622c1aadb6483aacde2bf3548158932f512a.tar.zst
gsoc2013-evolution-b1f9622c1aadb6483aacde2bf3548158932f512a.zip
Added view_replyto member.
2001-03-12 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.h: Added view_replyto member. * e-msg-composer.c (e_msg_composer_get_visible_flags): Find out if we want to view the Reply-To header. (e_msg_composer_set_view_replyto): A new function to set the state of the replyto header. (menu_view_replyto_cb): Callback for setting the ReplyTo state. (set_config): Make static. (setup_ui): Setup the ReplyTo bonobo stuff. (load_from_property_bag): More defaults for the ReplyTo, yay. (load_from_gnome_config): Again... (e_msg_composer_get_view_bcc): Implemented. (e_msg_composer_get_view_cc): Implemented. (e_msg_composer_get_view_from): Implemented. (e_msg_composer_get_view_replyto): Implemented. * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_reply_to_entry): New function, yay. (e_msg_composer_hdrs_get_reply_to): Another new function. (e_msg_composer_hdrs_set_reply_to): Yet another new function... (create_headers): Create the reply-to header. (attach_headers): Attach the reply_to. (headers_set_visibility): Set the reply_to visibility. (e_msg_composer_hdrs_to_message): Set the message's reply-to here based on the user-set reply-to header. svn path=/trunk/; revision=8657
Diffstat (limited to 'composer/e-msg-composer-hdrs.c')
-rw-r--r--composer/e-msg-composer-hdrs.c87
1 files changed, 76 insertions, 11 deletions
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index 57ae25a5f8..f6858ee492 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -46,10 +46,11 @@
/* Indexes in the GtkTable assigned to various items */
#define LINE_FROM 0
-#define LINE_TO 1
-#define LINE_CC 2
-#define LINE_BCC 3
-#define LINE_SUBJECT 4
+#define LINE_REPLYTO 1
+#define LINE_TO 2
+#define LINE_CC 3
+#define LINE_BCC 4
+#define LINE_SUBJECT 5
typedef struct {
GtkWidget *label;
@@ -65,7 +66,7 @@ struct _EMsgComposerHdrsPrivate {
GSList *from_options;
/* Standard headers. */
- Pair from, to, cc, bcc, subject;
+ Pair from, reply_to, to, cc, bcc, subject;
};
@@ -174,7 +175,6 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
omenu = gtk_option_menu_new ();
menu = gtk_menu_new ();
-
accounts = mail_config_get_accounts ();
while (accounts) {
@@ -346,6 +346,17 @@ create_headers (EMsgComposerHdrs *hdrs)
priv->from.entry = create_from_optionmenu (hdrs);
/*
+ * Reply-To:
+ */
+ priv->reply_to.label = gtk_label_new (_("Reply-To:"));
+ priv->reply_to.entry = e_entry_new ();
+ gtk_object_set (GTK_OBJECT (priv->reply_to.entry),
+ "editable", TRUE,
+ "use_ellipsis", TRUE,
+ "allow_newlines", FALSE,
+ NULL);
+
+ /*
* Subject:
*/
priv->subject.label = gtk_label_new (_("Subject:"));
@@ -391,7 +402,7 @@ attach_couple (EMsgComposerHdrs *hdrs, Pair *pair, int line)
pair->label, 0, 1,
line, line + 1,
GTK_FILL, GTK_FILL, pad, pad);
-
+
gtk_table_attach (
GTK_TABLE (hdrs),
pair->entry, 1, 2,
@@ -405,6 +416,7 @@ attach_headers (EMsgComposerHdrs *hdrs)
EMsgComposerHdrsPrivate *p = hdrs->priv;
attach_couple (hdrs, &p->from, LINE_FROM);
+ attach_couple (hdrs, &p->reply_to, LINE_REPLYTO);
attach_couple (hdrs, &p->to, LINE_TO);
attach_couple (hdrs, &p->cc, LINE_CC);
attach_couple (hdrs, &p->bcc, LINE_BCC);
@@ -429,6 +441,7 @@ headers_set_visibility (EMsgComposerHdrs *h, gint visible_flags)
EMsgComposerHdrsPrivate *p = h->priv;
set_pair_visibility (h, &p->from, visible_flags & E_MSG_COMPOSER_VISIBLE_FROM);
+ set_pair_visibility (h, &p->reply_to, visible_flags & E_MSG_COMPOSER_VISIBLE_REPLYTO);
set_pair_visibility (h, &p->cc, visible_flags & E_MSG_COMPOSER_VISIBLE_CC);
set_pair_visibility (h, &p->bcc, visible_flags & E_MSG_COMPOSER_VISIBLE_BCC);
set_pair_visibility (h, &p->subject, visible_flags & E_MSG_COMPOSER_VISIBLE_SUBJECT);
@@ -620,8 +633,8 @@ void
e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
CamelMimeMessage *msg)
{
+ CamelInternetAddress *addr;
gchar *subject;
- CamelInternetAddress *from;
g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
@@ -632,9 +645,15 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
camel_mime_message_set_subject (msg, subject);
g_free (subject);
- from = e_msg_composer_hdrs_get_from (hdrs);
- camel_mime_message_set_from (msg, from);
- camel_object_unref (CAMEL_OBJECT (from));
+ addr = e_msg_composer_hdrs_get_from (hdrs);
+ camel_mime_message_set_from (msg, addr);
+ camel_object_unref (CAMEL_OBJECT (addr));
+
+ addr = e_msg_composer_hdrs_get_reply_to (hdrs);
+ if (addr) {
+ camel_mime_message_set_reply_to (msg, addr);
+ camel_object_unref (CAMEL_OBJECT (addr));
+ }
set_recipients (msg, hdrs->priv->to.entry, CAMEL_RECIPIENT_TYPE_TO);
set_recipients (msg, hdrs->priv->cc.entry, CAMEL_RECIPIENT_TYPE_CC);
@@ -686,8 +705,10 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
account = gtk_object_get_data (GTK_OBJECT (item), "account");
if ((account_name && !strcmp (account_name, account->name)) ||
(!account_name && account->default_account)) {
+ /* set the correct optionlist item */
gtk_option_menu_set_history (omenu, i);
gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", hdrs);
+
return;
}
@@ -697,6 +718,17 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
}
void
+e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
+ const char *reply_to)
+{
+ g_return_if_fail (hdrs != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
+
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->reply_to.entry),
+ "text", reply_to, NULL);
+}
+
+void
e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
const GList *to_list)
{
@@ -761,6 +793,30 @@ e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs)
return addr;
}
+CamelInternetAddress *
+e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs)
+{
+ CamelInternetAddress *addr;
+ gchar *reply_to;
+
+ g_return_val_if_fail (hdrs != NULL, NULL);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ gtk_object_get (GTK_OBJECT (hdrs->priv->reply_to.entry),
+ "text", &reply_to, NULL);
+
+ addr = camel_internet_address_new ();
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) == -1) {
+ g_free (reply_to);
+ camel_object_unref (CAMEL_OBJECT (addr));
+ return NULL;
+ }
+
+ g_free (reply_to);
+
+ return addr;
+}
+
/* FIXME this is currently unused and broken. */
GList *
e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
@@ -813,6 +869,15 @@ e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs)
GtkWidget *
+e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs)
+{
+ g_return_val_if_fail (hdrs != NULL, NULL);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ return hdrs->priv->reply_to.entry;
+}
+
+GtkWidget *
e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs)
{
g_return_val_if_fail (hdrs != NULL, NULL);