aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-21 00:02:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-21 00:56:55 +0800
commita1f287ca6bf35d27e5dcb9b89a10f76e9abbd057 (patch)
treecfc2fe1694a379a53e533d19edcf1205e55d54e5 /composer/e-msg-composer.c
parentacabcb0be8e3c983e3400d7f7436f618e0000cfe (diff)
downloadgsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.gz
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.bz2
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.lz
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.xz
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.zst
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.zip
Bug 274117 – Difficult to post a new message to newsgroups
Completely rewrite how composer headers are managed. There's now two sets of headers (with some overlap): one set is for sending an email message, the other is for posting to a newsgroup. The correct set of headers is chosen on-the-fly based on the currently selected account type. The user's "view" preferences for these two sets are stored separately, so that switching between an email account and a news account will no longer stomp on your preferences. This also eliminates the need for the "Post New Message to Folder" and "Post a Reply" actions, so they've been removed. Usenet users can now just highlight a newsgroup in the folder tree and click New or Reply, and the composer window will show the correct set of headers with the Post-To field filled in automatically. Comment #6 in the bug discusses other standard news reader behaviors we still don't get right, particularly the missing "Followup To" header. These will be dealt with separately.
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c177
1 files changed, 15 insertions, 162 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9325e0b770..9b526f63ac 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -113,37 +113,6 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_MSG_COMPOSER, EMsgComposerPrivate))
-#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_POST \
- (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | \
- E_MSG_COMPOSER_VISIBLE_POSTTO)
-
-typedef enum {
- 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),
- E_MSG_COMPOSER_VISIBLE_SUBJECT = (1 << 7)
-} EMsgComposerHeaderVisibleFlags;
-
enum {
SEND,
SAVE_DRAFT,
@@ -399,6 +368,7 @@ build_message_headers (EMsgComposer *composer,
gboolean redirect)
{
EComposerHeaderTable *table;
+ EComposerHeader *header;
EAccount *account;
const gchar *subject;
const gchar *reply_to;
@@ -449,9 +419,9 @@ build_message_headers (EMsgComposer *composer,
}
/* To:, Cc:, Bcc: */
- if (e_composer_header_table_get_header_visible (table, E_COMPOSER_HEADER_TO) ||
- e_composer_header_table_get_header_visible (table, E_COMPOSER_HEADER_CC) ||
- e_composer_header_table_get_header_visible (table, E_COMPOSER_HEADER_BCC)) {
+ header = e_composer_header_table_get_header (
+ table, E_COMPOSER_HEADER_TO);
+ if (e_composer_header_get_visible (header)) {
EDestination **to, **cc, **bcc;
to = e_composer_header_table_get_destinations_to (table);
@@ -466,7 +436,9 @@ build_message_headers (EMsgComposer *composer,
}
/* X-Evolution-PostTo: */
- if (e_composer_header_table_get_header_visible (table, E_COMPOSER_HEADER_POST_TO)) {
+ header = e_composer_header_table_get_header (
+ table, E_COMPOSER_HEADER_POST_TO);
+ if (e_composer_header_get_visible (header)) {
CamelMedium *medium = CAMEL_MEDIUM (msg);
const gchar *name = "X-Evolution-PostTo";
GList *list, *iter;
@@ -1541,36 +1513,6 @@ msg_composer_constructor (GType type,
G_OBJECT (composer), "current-folder");
g_array_append_val (array, binding_id);
- binding_id = gconf_bridge_bind_property (
- gconf_bridge_get (),
- COMPOSER_GCONF_VIEW_BCC_KEY,
- G_OBJECT (ACTION (VIEW_BCC)), "active");
- g_array_append_val (array, binding_id);
-
- binding_id = gconf_bridge_bind_property (
- gconf_bridge_get (),
- COMPOSER_GCONF_VIEW_CC_KEY,
- G_OBJECT (ACTION (VIEW_CC)), "active");
- g_array_append_val (array, binding_id);
-
- binding_id = gconf_bridge_bind_property (
- gconf_bridge_get (),
- COMPOSER_GCONF_VIEW_FROM_KEY,
- G_OBJECT (ACTION (VIEW_FROM)), "active");
- g_array_append_val (array, binding_id);
-
- binding_id = gconf_bridge_bind_property (
- gconf_bridge_get (),
- COMPOSER_GCONF_VIEW_POST_TO_KEY,
- G_OBJECT (ACTION (VIEW_POST_TO)), "active");
- g_array_append_val (array, binding_id);
-
- binding_id = gconf_bridge_bind_property (
- gconf_bridge_get (),
- COMPOSER_GCONF_VIEW_REPLY_TO_KEY,
- G_OBJECT (ACTION (VIEW_REPLY_TO)), "active");
- g_array_append_val (array, binding_id);
-
binding_id = gconf_bridge_bind_window (
gconf_bridge_get (),
COMPOSER_GCONF_WINDOW_PREFIX,
@@ -2322,87 +2264,6 @@ e_msg_composer_get_type (void)
/* Callbacks. */
-static EMsgComposer *
-create_composer (gint visible_mask)
-{
- EMsgComposer *composer;
- EComposerHeaderTable *table;
- GtkToggleAction *action;
- gboolean active;
-
- composer = g_object_new (E_TYPE_MSG_COMPOSER, NULL);
- table = E_COMPOSER_HEADER_TABLE (composer->priv->header_table);
-
- /* Configure View Menu */
-
- /* If we're mailing, you cannot disable "To". */
- action = GTK_TOGGLE_ACTION (ACTION (VIEW_TO));
- active = visible_mask & E_MSG_COMPOSER_VISIBLE_TO;
- gtk_action_set_sensitive (ACTION (VIEW_TO), active);
- gtk_toggle_action_set_active (action, active);
-
- /* Ditto for "Post-To". */
- action = GTK_TOGGLE_ACTION (ACTION (VIEW_POST_TO));
- active = visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO;
- gtk_action_set_sensitive (ACTION (VIEW_POST_TO), active);
- gtk_toggle_action_set_active (action, active);
-
- /* Disable "Cc" if we're posting. */
- if (!(visible_mask & E_MSG_COMPOSER_VISIBLE_CC)) {
- action = GTK_TOGGLE_ACTION (ACTION (VIEW_CC));
- gtk_toggle_action_set_active (action, FALSE);
- }
-
- /* Disable "Bcc" if we're posting. */
- if (!(visible_mask & E_MSG_COMPOSER_VISIBLE_BCC)) {
- action = GTK_TOGGLE_ACTION (ACTION (VIEW_BCC));
- gtk_toggle_action_set_active (action, FALSE);
- }
-
- action = GTK_TOGGLE_ACTION (ACTION (VIEW_SUBJECT));
- gtk_toggle_action_set_active (action, TRUE);
-
- return composer;
-}
-
-/**
- * e_msg_composer_new_with_type:
- *
- * Create a new message composer widget. The type can be
- * E_MSG_COMPOSER_MAIL, E_MSG_COMPOSER_POST or E_MSG_COMPOSER_MAIL_POST.
- *
- * Returns: A pointer to the newly created widget
- **/
-
-EMsgComposer *
-e_msg_composer_new_with_type (int type)
-{
- EMsgComposer *composer;
- gint visible_mask;
-
- switch (type) {
- case E_MSG_COMPOSER_MAIL:
- visible_mask = E_MSG_COMPOSER_VISIBLE_MASK_MAIL;
- break;
-
- case E_MSG_COMPOSER_POST:
- visible_mask = E_MSG_COMPOSER_VISIBLE_MASK_POST;
- break;
-
- default:
- visible_mask =
- E_MSG_COMPOSER_VISIBLE_MASK_MAIL |
- E_MSG_COMPOSER_VISIBLE_MASK_POST;
- break;
- }
-
- composer = create_composer (visible_mask);
-
- set_editor_text (composer, "", TRUE);
-
- return composer;
-}
-
/**
* e_msg_composer_new:
*
@@ -2413,7 +2274,7 @@ e_msg_composer_new_with_type (int type)
EMsgComposer *
e_msg_composer_new (void)
{
- return e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL);
+ return g_object_new (E_TYPE_MSG_COMPOSER, NULL);
}
static void
@@ -2839,25 +2700,13 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
GtkToggleAction *action;
struct _camel_header_raw *xev;
gint len, i;
- EMsgComposerPrivate *p;
for (headers = CAMEL_MIME_PART (message)->headers;headers;headers = headers->next) {
if (!strcmp (headers->name, "X-Evolution-PostTo"))
postto = g_list_append (postto, g_strstrip (g_strdup (headers->value)));
}
- if (postto != NULL)
- composer = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_POST);
- else
- composer = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
- p = composer->priv;
-
- if (!composer) {
- g_list_foreach (postto, (GFunc)g_free, NULL);
- g_list_free (postto);
- return NULL;
- }
-
+ composer = e_msg_composer_new ();
table = e_msg_composer_get_header_table (composer);
if (postto) {
@@ -3061,8 +2910,12 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
while (headers) {
if (g_ascii_strcasecmp (headers->name, "References") == 0 ||
g_ascii_strcasecmp (headers->name, "In-Reply-To") == 0) {
- g_ptr_array_add (p->extra_hdr_names, g_strdup (headers->name));
- g_ptr_array_add (p->extra_hdr_values, g_strdup (headers->value));
+ g_ptr_array_add (
+ composer->priv->extra_hdr_names,
+ g_strdup (headers->name));
+ g_ptr_array_add (
+ composer->priv->extra_hdr_values,
+ g_strdup (headers->value));
}
headers = headers->next;