aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog28
-rw-r--r--composer/e-msg-composer-hdrs.c87
-rw-r--r--composer/e-msg-composer-hdrs.h11
-rw-r--r--composer/e-msg-composer.c157
-rw-r--r--composer/e-msg-composer.h27
5 files changed, 268 insertions, 42 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index d900bee606..d783aad3d3 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,31 @@
+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.
+
2001-03-06 Miguel de Icaza <miguel@ximian.com>
* e-msg-composer.c (set_config): New function. Used to store
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);
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index 9a32aee0fc..7d8d985825 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -66,9 +66,10 @@ struct _EMsgComposerHdrsClass {
typedef enum {
E_MSG_COMPOSER_VISIBLE_FROM = 1,
- E_MSG_COMPOSER_VISIBLE_CC = 2,
- E_MSG_COMPOSER_VISIBLE_BCC = 4,
- E_MSG_COMPOSER_VISIBLE_SUBJECT = 8
+ E_MSG_COMPOSER_VISIBLE_REPLYTO = 2,
+ E_MSG_COMPOSER_VISIBLE_CC = 4,
+ E_MSG_COMPOSER_VISIBLE_BCC = 8,
+ E_MSG_COMPOSER_VISIBLE_SUBJECT = 16
} EMsgComposerHeaderVisibleFlags;
@@ -80,6 +81,8 @@ void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
const char *account_name);
+void e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
+ const char *reply_to);
void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
const GList *to_list);
void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
@@ -90,11 +93,13 @@ void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
const char *subject);
CamelInternetAddress *e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs);
+CamelInternetAddress *e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs);
GList *e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
GList *e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
GList *e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
+GtkWidget *e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_bcc_entry (EMsgComposerHdrs *hdrs);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 088161a1fe..7edc282f1e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -642,7 +642,7 @@ set_editor_text (EMsgComposer *composer, const char *sig_file, const char *text)
bonobo_object_unref (BONOBO_OBJECT(stream));
}
-void
+static void
set_config (EMsgComposer *composer, char *key, int val)
{
if (composer->property_bag){
@@ -748,46 +748,47 @@ struct _save_info {
int quitok;
};
-static void save_done(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
+static void
+save_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
{
struct _save_info *si = data;
if (ok && si->quitok)
- gtk_widget_destroy((GtkWidget *)si->composer);
+ gtk_widget_destroy (GTK_WIDGET (si->composer));
else
- gtk_object_unref((GtkObject *)si->composer);
+ gtk_object_unref (GTK_OBJECT (si->composer));
- g_free(info);
- g_free(si);
+ g_free (info);
+ g_free (si);
}
static void
-save_draft(EMsgComposer *composer, int quitok)
+save_draft (EMsgComposer *composer, int quitok)
{
CamelMimeMessage *msg;
CamelMessageInfo *info;
extern CamelFolder *drafts_folder;
struct _save_info *si;
-
+
composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */
- msg = e_msg_composer_get_message(composer);
-
+ msg = e_msg_composer_get_message (composer);
+
info = g_new0 (CamelMessageInfo, 1);
info->flags = CAMEL_MESSAGE_DRAFT;
-
- si = g_malloc(sizeof(*si));
+
+ si = g_malloc (sizeof (*si));
si->composer = composer;
- gtk_object_ref((GtkObject *)composer);
+ gtk_object_ref (GTK_OBJECT (composer));
si->quitok = quitok;
-
- mail_append_mail(drafts_folder, msg, info, save_done, si);
- camel_object_unref((CamelObject *)msg);
+
+ mail_append_mail (drafts_folder, msg, info, save_done, si);
+ camel_object_unref (CAMEL_OBJECT (msg));
}
static void
menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
{
- save_draft(E_MSG_COMPOSER(data), FALSE);
+ save_draft (E_MSG_COMPOSER (data), FALSE);
}
static void
@@ -1088,8 +1089,8 @@ fs_selection_get (GtkWidget *widget, GtkSelectionData *sdata,
g_free (buffer);
gtk_object_remove_data (GTK_OBJECT (widget), "ev_file_buffer");
}
-
#endif
+
static void
menu_file_insert_file_cb (BonoboUIComponent *uic,
void *data,
@@ -1172,6 +1173,19 @@ menu_view_from_cb (BonoboUIComponent *component,
}
static void
+menu_view_replyto_cb (BonoboUIComponent *component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ gpointer user_data)
+{
+ if (type != Bonobo_UIComponent_STATE_CHANGED)
+ return;
+
+ e_msg_composer_set_view_replyto (E_MSG_COMPOSER (user_data), atoi (state));
+}
+
+static void
menu_view_bcc_cb (BonoboUIComponent *component,
const char *path,
Bonobo_UIComponent_EventType type,
@@ -1250,6 +1264,14 @@ setup_ui (EMsgComposer *composer)
composer->uic, "ViewFrom",
menu_view_from_cb, composer);
+ /* View/ReplyTo */
+ bonobo_ui_component_set_prop (
+ composer->uic, "/commands/ViewReplyTo",
+ "state", composer->view_replyto ? "1" : "0", NULL);
+ bonobo_ui_component_add_listener (
+ composer->uic, "ViewReplyTo",
+ menu_view_replyto_cb, composer);
+
/* View/BCC */
bonobo_ui_component_set_prop (
composer->uic, "/commands/ViewBCC",
@@ -1571,6 +1593,7 @@ load_from_property_bag (EMsgComposer *composer)
Bonobo_PropertyBag bag = composer->property_bag;
composer->view_from = load_with_failue_control (bag, "ViewFrom", 1);
+ composer->view_replyto = load_with_failue_control (bag, "ViewReplyTo", 0);
composer->view_bcc = load_with_failue_control (bag, "ViewBCC", 0);
composer->view_cc = load_with_failue_control (bag, "ViewCC", 1);
composer->view_subject = load_with_failue_control (bag, "ViewSubject", 1);
@@ -1580,6 +1603,7 @@ static void
load_from_gnome_config (EMsgComposer *composer)
{
composer->view_from = get_config_value ("ViewFrom=1");
+ composer->view_replyto = get_config_value ("ViewReplyTo=0");
composer->view_bcc = get_config_value ("ViewBCC=0");
composer->view_cc = get_config_value ("ViewCC=1");
composer->view_subject = get_config_value ("ViewSubject=1");
@@ -1612,6 +1636,8 @@ e_msg_composer_get_visible_flags (EMsgComposer *composer)
if (composer->view_from)
flags |= E_MSG_COMPOSER_VISIBLE_FROM;
+ if (composer->view_replyto)
+ flags |= E_MSG_COMPOSER_VISIBLE_REPLYTO;
if (composer->view_cc)
flags |= E_MSG_COMPOSER_VISIBLE_CC;
if (composer->view_bcc)
@@ -2501,6 +2527,23 @@ e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
}
/**
+ * e_msg_composer_get_view_bcc:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "View BCC header" flag.
+ *
+ * Return value: The status of the "View BCC header" flag.
+ **/
+gboolean
+e_msg_composer_get_view_bcc (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->view_bcc;
+}
+
+/**
* e_msg_composer_set_view_cc:
* @composer: A message composer widget
* @state: whether to show or hide the cc view
@@ -2528,6 +2571,23 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
}
/**
+ * e_msg_composer_get_view_cc:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "View CC header" flag.
+ *
+ * Return value: The status of the "View CC header" flag.
+ **/
+gboolean
+e_msg_composer_get_view_cc (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->view_cc;
+}
+
+/**
* e_msg_composer_set_view_from:
* @composer: A message composer widget
* @state: whether to show or hide the From selector
@@ -2555,6 +2615,67 @@ e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from)
}
/**
+ * e_msg_composer_get_view_from:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "View From header" flag.
+ *
+ * Return value: The status of the "View From header" flag.
+ **/
+gboolean
+e_msg_composer_get_view_from (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->view_from;
+}
+
+/**
+ * e_msg_composer_set_view_from:
+ * @composer: A message composer widget
+ * @state: whether to show or hide the From selector
+ *
+ * Controls the state of the From selector
+ */
+void
+e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto)
+{
+ g_return_if_fail (composer != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ if ((composer->view_replyto && view_replyto) ||
+ (!composer->view_replyto && !view_replyto))
+ return;
+
+ composer->view_replyto = view_replyto;
+ bonobo_ui_component_set_prop (
+ composer->uic, "/commands/ViewReplyTo",
+ "state", composer->view_replyto ? "1" : "0", NULL);
+ set_config (composer, "ViewReplyTo", composer->view_replyto);
+ e_msg_composer_set_hdrs_visible
+ (E_MSG_COMPOSER_HDRS (composer->hdrs),
+ e_msg_composer_get_visible_flags (composer));
+}
+
+/**
+ * e_msg_composer_get_view_replyto:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "View Reply-To header" flag.
+ *
+ * Return value: The status of the "View Reply-To header" flag.
+ **/
+gboolean
+e_msg_composer_get_view_replyto (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->view_replyto;
+}
+
+/**
* e_msg_composer_guess_mime_type:
* @file_name: filename
*
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index e03a89bfa6..5cca0590ac 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -76,14 +76,15 @@ struct _EMsgComposer {
char *sig_file;
gboolean attachment_bar_visible : 1;
- gboolean send_html : 1;
- gboolean pgp_sign : 1;
- gboolean pgp_encrypt : 1;
- gboolean view_from : 1;
- gboolean view_bcc : 1;
- gboolean view_cc : 1;
- gboolean view_subject: 1;
- gboolean has_changed : 1;
+ gboolean send_html : 1;
+ gboolean pgp_sign : 1;
+ gboolean pgp_encrypt : 1;
+ gboolean view_from : 1;
+ gboolean view_replyto : 1;
+ gboolean view_bcc : 1;
+ gboolean view_cc : 1;
+ gboolean view_subject : 1;
+ gboolean has_changed : 1;
};
struct _EMsgComposerClass {
@@ -127,21 +128,27 @@ void e_msg_composer_set_send_html (EMsgComposer *compose
gboolean e_msg_composer_get_view_from (EMsgComposer *composer);
void e_msg_composer_set_view_from (EMsgComposer *composer,
gboolean view_from);
+
+gboolean e_msg_composer_get_view_replyto (EMsgComposer *composer);
+void e_msg_composer_set_view_replyto (EMsgComposer *composer,
+ gboolean view_replyto);
+
gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer);
void e_msg_composer_set_view_bcc (EMsgComposer *composer,
gboolean view_bcc);
gboolean e_msg_composer_get_view_cc (EMsgComposer *composer);
void e_msg_composer_set_view_cc (EMsgComposer *composer,
gboolean view_cc);
-void e_msg_composer_set_pgp_sign (EMsgComposer *composer,
- gboolean pgp_sign);
const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
+void e_msg_composer_set_pgp_sign (EMsgComposer *composer,
+ gboolean pgp_sign);
gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer);
void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer,
gboolean pgp_encrypt);
gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer);
+
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
gchar * e_msg_composer_guess_mime_type (const gchar *file_name);