aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/ChangeLog22
-rw-r--r--composer/e-msg-composer-hdrs.c177
-rw-r--r--composer/e-msg-composer-hdrs.h46
-rw-r--r--composer/e-msg-composer.c106
-rw-r--r--composer/e-msg-composer.h55
5 files changed, 270 insertions, 136 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 3993e68d97..6c2ff04411 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,25 @@
+2002-07-24 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer-hdrs.c (create_headers): Create the Post-To
+ header.
+ (headers_set_visibility): Possibly show the Post-To header.
+ (attach_headers): Attach the Post-To header.
+ (e_msg_composer_hdrs_set_post_to): Set the text for the Post-To
+ header.
+ (e_msg_composer_hdrs_get_post_to_label): Return the label widget
+ for this header pair.
+ (e_msg_composer_hdrs_set_visible_mask): New function to set the
+ visible mask (so we can disallow certain headers to be shown).
+ (e_msg_composer_hdrs_new): Save the visible mask argument.
+ (setup_headers): To: does not always have to be visible anymore.
+ (e_msg_composer_hdrs_get_post_to): New function to get the url for
+ the Post-To folder.
+
+ * e-msg-composer.c (e_msg_composer_get_visible_flags): Set the
+ Post-To bit when it is supposed to be visible.
+ (e_msg_composer_new_post): Set the visible_mask to only allow the
+ headers needed for Posting.
+
2002-07-25 Dan Winship <danw@ximian.com>
* e-msg-composer.c (e_msg_composer_set_body): Fix spelling.
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index f856e2995b..c7bfe78160 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -21,6 +21,7 @@
* Author: Ettore Perazzoli
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,7 +58,9 @@
#define LINE_TO 2
#define LINE_CC 3
#define LINE_BCC 4
-#define LINE_SUBJECT 5
+#define LINE_POSTTO 5
+#define LINE_SUBJECT 6
+
typedef struct {
GtkWidget *label;
@@ -67,13 +70,16 @@ typedef struct {
struct _EMsgComposerHdrsPrivate {
GNOME_Evolution_Addressbook_SelectNames corba_select_names;
+ /* ui component */
+ BonoboUIComponent *uic;
+
/* The tooltips. */
GtkTooltips *tooltips;
GSList *from_options;
/* Standard headers. */
- EMsgComposerHdrPair from, reply_to, to, cc, bcc, subject;
+ EMsgComposerHdrPair from, reply_to, to, cc, bcc, post_to, subject;
};
@@ -95,24 +101,24 @@ setup_corba (EMsgComposerHdrs *hdrs)
{
EMsgComposerHdrsPrivate *priv;
CORBA_Environment ev;
-
+
priv = hdrs->priv;
-
+
g_assert (priv->corba_select_names == CORBA_OBJECT_NIL);
-
+
CORBA_exception_init (&ev);
-
+
priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFIID, 0, NULL, &ev);
-
+
/* OAF seems to be broken -- it can return a CORBA_OBJECT_NIL without
raising an exception in `ev'. */
if (ev._major != CORBA_NO_EXCEPTION || priv->corba_select_names == CORBA_OBJECT_NIL) {
CORBA_exception_free (&ev);
return FALSE;
}
-
+
CORBA_exception_free (&ev);
-
+
return TRUE;
}
@@ -144,8 +150,7 @@ e_msg_composer_hdrs_and_string_create (EMsgComposerHdrs *hdrs, const char *strin
}
static void
-address_button_clicked_cb (GtkButton *button,
- gpointer data)
+address_button_clicked_cb (GtkButton *button, gpointer data)
{
EMsgComposerHdrsAndString *emchas;
EMsgComposerHdrs *hdrs;
@@ -270,8 +275,7 @@ addressbook_entry_changed (BonoboListener *listener,
}
static GtkWidget *
-create_addressbook_entry (EMsgComposerHdrs *hdrs,
- const char *name)
+create_addressbook_entry (EMsgComposerHdrs *hdrs, const char *name)
{
EMsgComposerHdrsPrivate *priv;
GNOME_Evolution_Addressbook_SelectNames corba_select_names;
@@ -319,7 +323,7 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs,
}
static EMsgComposerHdrPair
-header_new_recipient (EMsgComposerHdrs *hdrs, const gchar *name, const gchar *tip)
+header_new_recipient (EMsgComposerHdrs *hdrs, const char *name, const char *tip)
{
EMsgComposerHdrsPrivate *priv;
EMsgComposerHdrPair ret;
@@ -380,13 +384,13 @@ create_headers (EMsgComposerHdrs *hdrs)
NULL);
/*
- * From:
+ * From
*/
priv->from.label = gtk_label_new (_("From:"));
priv->from.entry = create_from_optionmenu (hdrs);
/*
- * Subject:
+ * Subject
*/
priv->subject.label = gtk_label_new (_("Subject:"));
priv->subject.entry = e_entry_new ();
@@ -399,7 +403,7 @@ create_headers (EMsgComposerHdrs *hdrs)
GTK_SIGNAL_FUNC (entry_changed), hdrs);
/*
- * To: CC: and Bcc:
+ * To, CC, and Bcc
*/
priv->to = header_new_recipient (
hdrs, _("To:"),
@@ -414,13 +418,12 @@ create_headers (EMsgComposerHdrs *hdrs)
_("Enter the addresses that will receive a carbon copy of "
"the message without appearing in the recipient list of "
"the message."));
-}
-
-static GtkDirectionType
-focus_cb (GtkContainer *contain, GtkDirectionType dir, gpointer closure)
-{
- g_message ("FOCUS: %d", dir);
- return dir;
+
+ /*
+ * Post-To
+ */
+ priv->post_to.label = gtk_label_new (_("Post To:"));
+ priv->post_to.entry = gtk_label_new ("");
}
static void
@@ -454,13 +457,14 @@ attach_headers (EMsgComposerHdrs *hdrs)
attach_couple (hdrs, &p->to, LINE_TO);
attach_couple (hdrs, &p->cc, LINE_CC);
attach_couple (hdrs, &p->bcc, LINE_BCC);
+ attach_couple (hdrs, &p->post_to, LINE_POSTTO);
attach_couple (hdrs, &p->subject, LINE_SUBJECT);
}
static void
-set_pair_visibility (EMsgComposerHdrs *h, EMsgComposerHdrPair *pair, gboolean visible)
+set_pair_visibility (EMsgComposerHdrs *h, EMsgComposerHdrPair *pair, int visible)
{
- if (visible){
+ if (visible & h->visible_mask) {
gtk_widget_show (pair->label);
gtk_widget_show (pair->entry);
} else {
@@ -474,17 +478,53 @@ headers_set_visibility (EMsgComposerHdrs *h, int visible_flags)
{
EMsgComposerHdrsPrivate *p = h->priv;
+ /* To is always visible if we're not doing Post-To */
+ if (!(h->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO))
+ visible_flags |= E_MSG_COMPOSER_VISIBLE_TO;
+ else
+ visible_flags |= E_MSG_COMPOSER_VISIBLE_POSTTO;
+
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->to, visible_flags & E_MSG_COMPOSER_VISIBLE_TO);
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->post_to, visible_flags & E_MSG_COMPOSER_VISIBLE_POSTTO);
set_pair_visibility (h, &p->subject, visible_flags & E_MSG_COMPOSER_VISIBLE_SUBJECT);
}
+static void
+headers_set_sensitivity (EMsgComposerHdrs *h)
+{
+ bonobo_ui_component_set_prop (
+ h->priv->uic, "/commands/ViewFrom", "sensitive",
+ h->visible_mask & E_MSG_COMPOSER_VISIBLE_FROM ? "1" : "0", NULL);
+
+ bonobo_ui_component_set_prop (
+ h->priv->uic, "/commands/ViewReplyTo", "sensitive",
+ h->visible_mask & E_MSG_COMPOSER_VISIBLE_REPLYTO ? "1" : "0", NULL);
+
+ bonobo_ui_component_set_prop (
+ h->priv->uic, "/commands/ViewCC", "sensitive",
+ h->visible_mask & E_MSG_COMPOSER_VISIBLE_CC ? "1" : "0", NULL);
+
+ bonobo_ui_component_set_prop (
+ h->priv->uic, "/commands/ViewBCC", "sensitive",
+ h->visible_mask & E_MSG_COMPOSER_VISIBLE_BCC ? "1" : "0", NULL);
+}
+
+void
+e_msg_composer_hdrs_set_visible_mask (EMsgComposerHdrs *hdrs, int visible_mask)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
+
+ hdrs->visible_mask = visible_mask;
+ headers_set_sensitivity (hdrs);
+}
+
void
-e_msg_composer_set_hdrs_visible (EMsgComposerHdrs *hdrs, int visible_flags)
+e_msg_composer_hdrs_set_visible (EMsgComposerHdrs *hdrs, int visible_flags)
{
- g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
headers_set_visibility (hdrs, visible_flags);
@@ -497,15 +537,10 @@ setup_headers (EMsgComposerHdrs *hdrs, int visible_flags)
create_headers (hdrs);
attach_headers (hdrs);
- /*
- * To: is always visible
- */
- gtk_widget_show (hdrs->priv->to.label);
- gtk_widget_show (hdrs->priv->to.entry);
-
+ headers_set_sensitivity (hdrs);
headers_set_visibility (hdrs, visible_flags);
}
-
+
/* GtkObject methods. */
@@ -635,19 +670,22 @@ e_msg_composer_hdrs_get_type (void)
}
GtkWidget *
-e_msg_composer_hdrs_new (int visible_flags)
+e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_flags)
{
EMsgComposerHdrs *new;
EMsgComposerHdrsPrivate *priv;
new = gtk_type_new (e_msg_composer_hdrs_get_type ());
priv = new->priv;
+ priv->uic = uic;
if (!setup_corba (new)) {
gtk_widget_destroy (GTK_WIDGET (new));
return NULL;
}
+ new->visible_mask = visible_mask;
+
setup_headers (new, visible_flags);
return GTK_WIDGET (new);
@@ -745,9 +783,7 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
char *subject, *header;
EDestination **to_destv, **cc_destv, **bcc_destv;
- g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- g_return_if_fail (msg != NULL);
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
subject = e_msg_composer_hdrs_get_subject (hdrs);
@@ -770,17 +806,19 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
camel_object_unref (CAMEL_OBJECT (addr));
}
- to_destv = e_msg_composer_hdrs_get_to (hdrs);
- cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
- bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
-
- /* Attach destinations to the message. */
-
- set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv, redirect);
-
- e_destination_freev (to_destv);
- e_destination_freev (cc_destv);
- e_destination_freev (bcc_destv);
+ if (hdrs->visible_mask & E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS) {
+ to_destv = e_msg_composer_hdrs_get_to (hdrs);
+ cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
+ bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
+
+ /* Attach destinations to the message. */
+
+ set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv, redirect);
+
+ e_destination_freev (to_destv);
+ e_destination_freev (cc_destv);
+ e_destination_freev (bcc_destv);
+ }
}
@@ -811,7 +849,6 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
int i = 0;
int default_account = 0;
- g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
omenu = GTK_OPTION_MENU (e_msg_composer_hdrs_get_from_omenu (hdrs));
@@ -905,10 +942,19 @@ e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
}
void
+e_msg_composer_hdrs_set_post_to (EMsgComposerHdrs *hdrs,
+ const char *post_to)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
+ g_return_if_fail (post_to != NULL);
+
+ gtk_label_set_text (GTK_LABEL (hdrs->priv->post_to.entry), post_to);
+}
+
+void
e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
const char *subject)
{
- g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
g_return_if_fail (subject != NULL);
@@ -924,7 +970,6 @@ e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs)
const MailConfigAccount *account;
CamelInternetAddress *addr;
- g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
account = hdrs->account;
@@ -1061,11 +1106,22 @@ e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs)
}
char *
+e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs)
+{
+ char *post_to = NULL;
+
+ g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ gtk_label_get (GTK_LABEL (hdrs->priv->post_to.entry), &post_to);
+
+ return g_strdup (post_to);
+}
+
+char *
e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs)
{
char *subject;
- 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->subject.entry),
@@ -1078,7 +1134,6 @@ 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;
@@ -1087,7 +1142,6 @@ e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs)
GtkWidget *
e_msg_composer_hdrs_get_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->to.entry;
@@ -1096,7 +1150,6 @@ e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs)
GtkWidget *
e_msg_composer_hdrs_get_cc_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->cc.entry;
@@ -1105,16 +1158,22 @@ e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs)
GtkWidget *
e_msg_composer_hdrs_get_bcc_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->bcc.entry;
}
GtkWidget *
+e_msg_composer_hdrs_get_post_to_label (EMsgComposerHdrs *hdrs)
+{
+ g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
+
+ return hdrs->priv->post_to.entry;
+}
+
+GtkWidget *
e_msg_composer_hdrs_get_subject_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->subject.entry;
@@ -1123,7 +1182,6 @@ e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs)
GtkWidget *
e_msg_composer_hdrs_get_from_hbox (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->from.entry;
@@ -1132,7 +1190,6 @@ e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs)
GtkWidget *
e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs)
{
- g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
return GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (hdrs->priv->from.entry), "from_menu"));
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index cd8d8fb579..c175dc6564 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -21,10 +21,14 @@
* Author: Ettore Perazzoli
*/
+
#ifndef ___E_MSG_COMPOSER_HDRS_H__
#define ___E_MSG_COMPOSER_HDRS_H__
#include <gtk/gtktable.h>
+
+#include <bonobo/bonobo-ui-component.h>
+
#include <camel/camel-mime-message.h>
#include <addressbook/backend/ebook/e-destination.h>
#include <mail/mail-config.h>
@@ -54,6 +58,8 @@ struct _EMsgComposerHdrs {
const MailConfigAccount *account;
+ guint32 visible_mask;
+
gboolean has_changed;
};
@@ -70,16 +76,27 @@ struct _EMsgComposerHdrsClass {
};
typedef enum {
- E_MSG_COMPOSER_VISIBLE_FROM = 1,
- E_MSG_COMPOSER_VISIBLE_REPLYTO = 2,
- E_MSG_COMPOSER_VISIBLE_CC = 4,
- E_MSG_COMPOSER_VISIBLE_BCC = 8,
- E_MSG_COMPOSER_VISIBLE_SUBJECT = 16
+ E_MSG_COMPOSER_VISIBLE_FROM = (1 << 0),
+ E_MSG_COMPOSER_VISIBLE_REPLYTO = (1 << 1),
+ E_MSG_COMPOSER_VISIBLE_TO = (1 << 2),
+ E_MSG_COMPOSER_VISIBLE_CC = (1 << 3),
+ E_MSG_COMPOSER_VISIBLE_BCC = (1 << 4),
+ E_MSG_COMPOSER_VISIBLE_POSTTO = (1 << 5), /* for posting to folders */
+ E_MSG_COMPOSER_VISIBLE_NEWSGROUP = (1 << 6), /* for posting to newsgroups */
+ E_MSG_COMPOSER_VISIBLE_SUBJECT = (1 << 7)
} EMsgComposerHeaderVisibleFlags;
-
+#define E_MSG_COMPOSER_VISIBLE_MASK_SENDER (E_MSG_COMPOSER_VISIBLE_FROM | E_MSG_COMPOSER_VISIBLE_REPLYTO)
+#define E_MSG_COMPOSER_VISIBLE_MASK_BASIC (E_MSG_COMPOSER_VISIBLE_MASK_SENDER | E_MSG_COMPOSER_VISIBLE_SUBJECT)
+#define E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS (E_MSG_COMPOSER_VISIBLE_TO | E_MSG_COMPOSER_VISIBLE_CC | E_MSG_COMPOSER_VISIBLE_BCC)
+
+#define E_MSG_COMPOSER_VISIBLE_MASK_MAIL (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS)
+#define E_MSG_COMPOSER_VISIBLE_MASK_NEWS (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | E_MSG_COMPOSER_VISIBLE_NEWSGROUP)
+#define E_MSG_COMPOSER_VISIBLE_MASK_POST (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | E_MSG_COMPOSER_VISIBLE_POSTTO)
+
+
GtkType e_msg_composer_hdrs_get_type (void);
-GtkWidget *e_msg_composer_hdrs_new (gint visible_flags);
+GtkWidget *e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_flags);
void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
CamelMimeMessage *msg);
@@ -87,6 +104,7 @@ void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
void e_msg_composer_hdrs_to_redirect (EMsgComposerHdrs *hdrs,
CamelMimeMessage *msg);
+
void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
const char *account_name);
void e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
@@ -97,6 +115,8 @@ void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
EDestination **cc_destv);
void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
EDestination **bcc_destv);
+void e_msg_composer_hdrs_set_post_to (EMsgComposerHdrs *hdrs,
+ const char *post_to);
void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
const char *subject);
@@ -107,18 +127,22 @@ EDestination **e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
EDestination **e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
EDestination **e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
EDestination **e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs);
+char *e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs);
char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
+GtkWidget *e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs);
+GtkWidget *e_msg_composer_hdrs_get_from_omenu (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);
+GtkWidget *e_msg_composer_hdrs_get_post_to_label (EMsgComposerHdrs *hdrs);
GtkWidget *e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs);
-GtkWidget *e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs);
-GtkWidget *e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs);
-void e_msg_composer_set_hdrs_visible (EMsgComposerHdrs *hdrs,
- gint flags);
+void e_msg_composer_hdrs_set_visible_mask (EMsgComposerHdrs *hdrs,
+ int visible_mask);
+void e_msg_composer_hdrs_set_visible (EMsgComposerHdrs *hdrs,
+ int visible_flags);
#ifdef _cplusplus
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9a89d2fecf..c1b493b65c 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -765,7 +765,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
static char *
get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_html, guint flags, gboolean warn)
{
- CamelStreamFilter *filtered_stream;
+ CamelStreamFilter *filtered_stream;
CamelStreamMem *memstream;
CamelMimeFilter *html, *charenc;
CamelStream *stream;
@@ -1676,29 +1676,29 @@ menu_view_replyto_cb (BonoboUIComponent *component,
}
static void
-menu_view_bcc_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+menu_view_cc_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_bcc (E_MSG_COMPOSER (user_data), atoi (state));
+ e_msg_composer_set_view_cc (E_MSG_COMPOSER (user_data), atoi (state));
}
static void
-menu_view_cc_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+menu_view_bcc_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_cc (E_MSG_COMPOSER (user_data), atoi (state));
+ e_msg_composer_set_view_bcc (E_MSG_COMPOSER (user_data), atoi (state));
}
static void
@@ -1908,7 +1908,7 @@ setup_signatures_menu (EMsgComposer *composer)
if (list)
for (l = list; l; len ++, l = l->next) {
gchar *gtk_str;
-
+
gtk_str = e_utf8_to_gtk_string (menu, ((MailConfigSignature *)l->data)->name);
ADD (gtk_str);
g_free (gtk_str);
@@ -1916,11 +1916,11 @@ setup_signatures_menu (EMsgComposer *composer)
ADD (NULL);
ADD (_("Set as default"));
#undef ADD
-
+
gtk_widget_show (menu);
gtk_option_menu_set_menu (GTK_OPTION_MENU (composer->sig_omenu), menu);
sig_select_item (composer);
-
+
gtk_signal_connect (GTK_OBJECT (menu), "selection-done", signature_cb, composer);
}
@@ -1982,14 +1982,6 @@ setup_ui (EMsgComposer *composer)
composer->uic, "ViewReplyTo",
menu_view_replyto_cb, composer);
- /* View/BCC */
- bonobo_ui_component_set_prop (
- composer->uic, "/commands/ViewBCC",
- "state", composer->view_bcc ? "1" : "0", NULL);
- bonobo_ui_component_add_listener (
- composer->uic, "ViewBCC",
- menu_view_bcc_cb, composer);
-
/* View/CC */
bonobo_ui_component_set_prop (
composer->uic, "/commands/ViewCC",
@@ -1998,6 +1990,14 @@ setup_ui (EMsgComposer *composer)
composer->uic, "ViewCC",
menu_view_cc_cb, composer);
+ /* View/BCC */
+ bonobo_ui_component_set_prop (
+ composer->uic, "/commands/ViewBCC",
+ "state", composer->view_bcc ? "1" : "0", NULL);
+ bonobo_ui_component_add_listener (
+ composer->uic, "ViewBCC",
+ menu_view_bcc_cb, composer);
+
/* Security -> PGP Sign */
bonobo_ui_component_set_prop (
composer->uic, "/commands/SecurityPGPSign",
@@ -2050,7 +2050,7 @@ setup_ui (EMsgComposer *composer)
bonobo_ui_component_add_listener (
composer->uic, "ViewAttach",
menu_view_attachments_activate_cb, composer);
-
+
mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, composer);
bonobo_ui_component_thaw (composer->uic, NULL);
@@ -2455,7 +2455,7 @@ static void marshal_NONE__NONE_INT (GtkObject *object, GtkSignalFunc func,
(*rfunc)(object, GTK_VALUE_INT (args[0]), func_data);
}
-
+
static void
class_init (EMsgComposerClass *klass)
{
@@ -2566,10 +2566,10 @@ load_from_config_db (EMsgComposer *composer)
db, "Mail/Composer/ViewFrom", 1, NULL);
composer->view_replyto = bonobo_config_get_long_with_default (
db, "Mail/Composer/ViewReplyTo", 0, NULL);
+ composer->view_cc = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewCC", 1, NULL);
composer->view_bcc = bonobo_config_get_long_with_default (
db, "Mail/Composer/ViewBCC", 0, NULL);
- composer->view_cc = bonobo_config_get_long_with_default (
- db, "Mail/Composer/ViewCC", 1, NULL);
composer->view_subject = bonobo_config_get_long_with_default (
db, "Mail/Composer/ViewSubject", 1, NULL);
}
@@ -2674,7 +2674,7 @@ msg_composer_destroy_notify (void *data)
}
static EMsgComposer *
-create_composer (void)
+create_composer (int visible_mask)
{
EMsgComposer *composer;
GtkWidget *vbox;
@@ -2710,7 +2710,7 @@ create_composer (void)
vbox = gtk_vbox_new (FALSE, 0);
vis = e_msg_composer_get_visible_flags (composer);
- composer->hdrs = e_msg_composer_hdrs_new (vis);
+ composer->hdrs = e_msg_composer_hdrs_new (composer->uic, visible_mask, vis);
if (!composer->hdrs) {
e_activation_failure_dialog (GTK_WINDOW (composer),
_("Could not create composer window:\n"
@@ -2831,6 +2831,7 @@ set_editor_signature (EMsgComposer *composer)
/* printf ("set_editor_signature end\n"); */
}
+
/**
* e_msg_composer_new:
*
@@ -2843,7 +2844,30 @@ e_msg_composer_new (void)
{
EMsgComposer *new;
- new = create_composer ();
+ new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
+ if (new) {
+ e_msg_composer_set_send_html (new, mail_config_get_send_html ());
+ set_editor_text (new, "");
+ set_editor_signature (new);
+ }
+
+ return new;
+}
+
+
+/**
+ * e_msg_composer_new_post:
+ *
+ * Create a new message composer widget.
+ *
+ * Return value: A pointer to the newly created widget
+ **/
+EMsgComposer *
+e_msg_composer_new_post (void)
+{
+ EMsgComposer *new;
+
+ new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_POST);
if (new) {
e_msg_composer_set_send_html (new, mail_config_get_send_html ());
set_editor_text (new, "");
@@ -2853,6 +2877,7 @@ e_msg_composer_new (void)
return new;
}
+
static gboolean
is_special_header (const char *hdr_name)
{
@@ -3211,7 +3236,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
g_return_val_if_fail (gtk_main_level () > 0, NULL);
- new = create_composer ();
+ new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
if (!new)
return NULL;
@@ -3830,7 +3855,6 @@ e_msg_composer_get_message_draft (EMsgComposer *composer)
return msg;
}
-
static void
delete_old_signature (EMsgComposer *composer)
@@ -4179,7 +4203,7 @@ e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from)
composer->uic, "/commands/ViewFrom",
"state", composer->view_from ? "1" : "0", NULL);
set_config (composer, "ViewFrom", composer->view_from);
- e_msg_composer_set_hdrs_visible
+ e_msg_composer_hdrs_set_visible
(E_MSG_COMPOSER_HDRS (composer->hdrs),
e_msg_composer_get_visible_flags (composer));
}
@@ -4223,7 +4247,7 @@ e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto)
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_set_visible
(E_MSG_COMPOSER_HDRS (composer->hdrs),
e_msg_composer_get_visible_flags (composer));
}
@@ -4267,7 +4291,7 @@ e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
composer->uic, "/commands/ViewCC",
"state", composer->view_cc ? "1" : "0", NULL);
set_config (composer, "ViewCC", composer->view_cc);
- e_msg_composer_set_hdrs_visible
+ e_msg_composer_hdrs_set_visible
(E_MSG_COMPOSER_HDRS (composer->hdrs),
e_msg_composer_get_visible_flags (composer));
}
@@ -4311,7 +4335,7 @@ e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
composer->uic, "/commands/ViewBCC",
"state", composer->view_bcc ? "1" : "0", NULL);
set_config (composer, "ViewBCC", composer->view_bcc);
- e_msg_composer_set_hdrs_visible
+ e_msg_composer_hdrs_set_visible
(E_MSG_COMPOSER_HDRS (composer->hdrs),
e_msg_composer_get_visible_flags (composer));
}
@@ -4321,7 +4345,7 @@ EDestination **
e_msg_composer_get_recipients (EMsgComposer *composer)
{
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
+
return composer->hdrs ? e_msg_composer_hdrs_get_recipients (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL;
}
@@ -4430,7 +4454,7 @@ e_msg_composer_is_dirty (EMsgComposer *composer)
|| (GNOME_GtkHTML_Editor_Engine_hasUndo (composer->editor_engine, &ev) &&
!GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "is-saved", &ev));
CORBA_exception_free (&ev);
-
+
return rv;
}
@@ -4519,12 +4543,12 @@ gboolean
e_msg_composer_request_close_all (void)
{
GSList *p, *pnext;
-
+
for (p = all_composers; p != NULL; p = pnext) {
pnext = p->next;
do_exit (E_MSG_COMPOSER (p->data));
}
-
+
if (all_composers == NULL)
return TRUE;
else
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index be5a5899c2..f8f6c4850d 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -21,6 +21,7 @@
* Author: Ettore Perazzoli
*/
+
#ifndef ___E_MSG_COMPOSER_H__
#define ___E_MSG_COMPOSER_H__
@@ -76,33 +77,34 @@ struct _EMsgComposer {
Bonobo_ConfigDatabase config_db;
char *mime_type, *mime_body, *charset;
-
+
char *autosave_file;
int autosave_fd;
-
- gboolean attachment_bar_visible : 1;
- gboolean send_html : 1;
- gboolean is_alternative: 1;
- gboolean pgp_sign : 1;
- gboolean pgp_encrypt : 1;
- gboolean smime_sign : 1;
- gboolean smime_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;
-
- gboolean in_signature_insert : 1;
-
- gboolean enable_autosave : 1;
+ guint32 enable_autosave : 1;
+
+ guint32 attachment_bar_visible : 1;
+ guint32 send_html : 1;
+ guint32 is_alternative : 1;
+ guint32 pgp_sign : 1;
+ guint32 pgp_encrypt : 1;
+ guint32 smime_sign : 1;
+ guint32 smime_encrypt : 1;
+ guint32 view_from : 1;
+ guint32 view_replyto : 1;
+ guint32 view_bcc : 1;
+ guint32 view_cc : 1;
+ guint32 view_subject : 1;
+ guint32 has_changed : 1;
+
+ guint32 mode_post : 1;
+
+ guint32 in_signature_insert : 1;
+ guint32 auto_signature : 1;
- CamelMimeMessage *redirect;
-
MailConfigSignature *signature;
- gboolean auto_signature;
GtkWidget *sig_omenu;
+
+ CamelMimeMessage *redirect;
};
struct _EMsgComposerClass {
@@ -112,13 +114,17 @@ struct _EMsgComposerClass {
void (* save_draft) (EMsgComposer *composer, int quit);
};
-
+
GtkType e_msg_composer_get_type (void);
+
EMsgComposer *e_msg_composer_new (void);
+EMsgComposer *e_msg_composer_new_post (void);
+
EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg);
EMsgComposer *e_msg_composer_new_from_url (const char *url);
EMsgComposer *e_msg_composer_new_redirect (CamelMimeMessage *message,
const char *resent_from);
+
void e_msg_composer_show_attachments (EMsgComposer *composer,
gboolean show);
void e_msg_composer_set_headers (EMsgComposer *composer,
@@ -148,6 +154,7 @@ void e_msg_composer_show_sig_file (EMsgCo
gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
void e_msg_composer_set_send_html (EMsgComposer *composer,
gboolean send_html);
+
gboolean e_msg_composer_get_view_from (EMsgComposer *composer);
void e_msg_composer_set_view_from (EMsgComposer *composer,
gboolean view_from);
@@ -169,7 +176,7 @@ char *e_msg_composer_get_subject (EMsgCo
const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
-char *e_msg_composer_guess_mime_type (const gchar *file_name);
+char *e_msg_composer_guess_mime_type (const char *file_name);
void e_msg_composer_set_changed (EMsgComposer *composer);
void e_msg_composer_unset_changed (EMsgComposer *composer);
gboolean e_msg_composer_is_dirty (EMsgComposer *composer);