aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-22 01:06:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-22 01:06:45 +0800
commit84c2e3735ce6e4df88142e86446f9179b6e341e4 (patch)
tree7e6d2043810d0c37ee2581f0783095aefdec1e1b /composer/e-msg-composer.c
parentaaa180af5abef44bb3e3d3c3c5968ca191a3dbda (diff)
parent2914345f9672559fed0ad88d2841ea4801d8d244 (diff)
downloadgsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar.gz
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar.bz2
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar.lz
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar.xz
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.tar.zst
gsoc2013-evolution-84c2e3735ce6e4df88142e86446f9179b6e341e4.zip
Merge branch 'master' into kill-bonobo
Conflicts: addressbook/gui/component/addressbook-view.c addressbook/gui/component/component-factory.c addressbook/gui/component/eab-composer-util.h addressbook/gui/widgets/Makefile.am addressbook/gui/widgets/e-addressbook-model.c addressbook/gui/widgets/e-addressbook-view.c addressbook/gui/widgets/e-addressbook-view.h addressbook/gui/widgets/eab-gui-util.c addressbook/gui/widgets/eab-gui-util.h addressbook/gui/widgets/eab-menu.h addressbook/gui/widgets/eab-popup.h calendar/gui/calendar-component.c calendar/gui/e-cal-event.h calendar/gui/e-calendar-table.c calendar/gui/e-calendar-view.c calendar/gui/e-calendar-view.h calendar/gui/e-memo-table.c calendar/gui/memos-component.c calendar/gui/tasks-component.c composer/e-composer-header-table.c composer/e-composer-private.h composer/e-msg-composer.c composer/e-msg-composer.h composer/evolution-composer.ui configure.ac data/icons/Makefile.am em-format/em-format.c em-format/em-format.h mail/Makefile.am mail/e-mail-shell-migrate.c mail/e-searching-tokenizer.c mail/e-searching-tokenizer.h mail/em-composer-utils.c mail/em-composer-utils.h mail/em-folder-browser.c mail/em-folder-tree-model.c mail/em-folder-view.c mail/em-format-html-display.c mail/em-format-html-display.h mail/em-mailer-prefs.c mail/em-message-browser.c plugins/vcard-inline/Makefile.am plugins/vcard-inline/org-gnome-vcard-inline.eplug.xml plugins/vcard-inline/vcard-inline.c shell/e-component-registry.h shell/e-shell-window.c shell/es-menu.h widgets/misc/e-filter-bar.c widgets/misc/e-filter-bar.h widgets/misc/e-search-bar.c widgets/misc/e-search-bar.h
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c201
1 files changed, 17 insertions, 184 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 933b40c5aa..93bd6fdd3e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -93,37 +93,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,
@@ -478,6 +447,7 @@ build_message_headers (EMsgComposer *composer,
gboolean redirect)
{
EComposerHeaderTable *table;
+ EComposerHeader *header;
EAccount *account;
const gchar *subject;
const gchar *reply_to;
@@ -528,9 +498,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);
@@ -545,7 +515,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;
@@ -1484,36 +1456,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,
@@ -2254,88 +2196,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:
- * @type: the type of composer to create
- *
- * 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 (gint 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:
*
@@ -2346,25 +2206,7 @@ e_msg_composer_new_with_type (gint type)
EMsgComposer *
e_msg_composer_new (void)
{
- return e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL);
-}
-
-static gboolean
-is_special_header (const gchar *hdr_name)
-{
- /* Note: a header is a "special header" if it has any meaning:
- 1. it's not a X-* header or
- 2. it's an X-Evolution* header
- */
- if (g_ascii_strncasecmp (hdr_name, "X-", 2))
- return TRUE;
-
- if (!g_ascii_strncasecmp (hdr_name, "X-Evolution", 11))
- return TRUE;
-
- /* we can keep all other X-* headers */
-
- return FALSE;
+ return g_object_new (E_TYPE_MSG_COMPOSER, NULL);
}
static void
@@ -2792,25 +2634,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) {
@@ -3014,11 +2844,14 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
/* set extra headers */
headers = CAMEL_MIME_PART (message)->headers;
while (headers) {
- if (!is_special_header (headers->name) ||
- !g_ascii_strcasecmp (headers->name, "References") ||
- !g_ascii_strcasecmp (headers->name, "In-Reply-To")) {
- g_ptr_array_add (p->extra_hdr_names, g_strdup (headers->name));
- g_ptr_array_add (p->extra_hdr_values, g_strdup (headers->value));
+ if (g_ascii_strcasecmp (headers->name, "References") == 0 ||
+ g_ascii_strcasecmp (headers->name, "In-Reply-To") == 0) {
+ 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;