aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-composer-utils.c
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2009-05-22 20:00:14 +0800
committerSrinivasa Ragavan <sragavan@novell.com>2009-05-22 20:13:57 +0800
commit6d70e07d0842496327e1ca74f93047693ddc545c (patch)
tree01b40699c5371af70e97c81f3918eda6e3ae7ec1 /mail/em-composer-utils.c
parentff25805086bbd20226e4684f028912bdb29f0ae1 (diff)
downloadgsoc2013-evolution-6d70e07d0842496327e1ca74f93047693ddc545c.tar.gz
gsoc2013-evolution-6d70e07d0842496327e1ca74f93047693ddc545c.tar.zst
gsoc2013-evolution-6d70e07d0842496327e1ca74f93047693ddc545c.zip
Mail changes required for Anjal.
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r--mail/em-composer-utils.c74
1 files changed, 64 insertions, 10 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index f427feca6d..79dae420e8 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -653,13 +653,16 @@ em_composer_utils_setup_callbacks (EMsgComposer *composer,
/* Composing messages... */
static EMsgComposer *
-create_new_composer (const char *subject, const char *fromuri, gboolean use_default_callbacks)
+create_new_composer (const char *subject, const char *fromuri, gboolean use_default_callbacks, gboolean lite)
{
EMsgComposer *composer;
EComposerHeaderTable *table;
EAccount *account = NULL;
- composer = e_msg_composer_new ();
+ if (lite)
+ composer = e_msg_composer_lite_new ();
+ else
+ composer = e_msg_composer_new ();
table = e_msg_composer_get_header_table (composer);
if (fromuri != NULL) {
@@ -692,7 +695,7 @@ em_utils_compose_new_message (const char *fromuri)
{
GtkWidget *composer;
- composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE);
+ composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE, FALSE);
if (composer == NULL)
return;
@@ -702,6 +705,26 @@ em_utils_compose_new_message (const char *fromuri)
}
/**
+ * em_utils_compose_lite_new_message:
+ *
+ * Opens a new composer window as a child window of @parent's toplevel
+ * window.
+ **/
+struct _EMsgComposer *
+em_utils_compose_lite_new_message (const char *fromuri)
+{
+ GtkWidget *composer;
+
+ composer = (GtkWidget *) create_new_composer ("", fromuri, TRUE, TRUE);
+ if (composer == NULL)
+ return NULL;
+
+ composer_set_no_change (E_MSG_COMPOSER (composer), TRUE, TRUE);
+
+ return (struct _EMsgComposer *)composer;
+}
+
+/**
* em_utils_compose_new_message_with_mailto:
* @url: mailto url
*
@@ -1002,7 +1025,7 @@ forward_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, Cam
{
EMsgComposer *composer;
- composer = create_new_composer (subject, fromuri, TRUE);
+ composer = create_new_composer (subject, fromuri, TRUE, FALSE);
if (composer == NULL)
return;
@@ -1081,7 +1104,7 @@ forward_non_attached (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages,
text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL, NULL);
if (text) {
- composer = create_new_composer (subject, fromuri, !uids || !uids->pdata [i]);
+ composer = create_new_composer (subject, fromuri, !uids || !uids->pdata [i], FALSE);
if (composer) {
if (CAMEL_IS_MULTIPART(camel_medium_get_content_object((CamelMedium *)message)))
@@ -1642,7 +1665,7 @@ generate_account_hash (void)
return account_hash;
}
-static EDestination **
+EDestination **
em_utils_camel_address_to_destination (CamelInternetAddress *iaddr)
{
EDestination *dest, **destv;
@@ -1846,6 +1869,12 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP
}
}
+void
+em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
+{
+ get_reply_sender (message, to, postto);
+}
+
static gboolean
get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to)
{
@@ -1959,6 +1988,13 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne
g_hash_table_destroy (rcpt_hash);
}
+void
+em_utils_get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInternetAddress *cc, CamelNNTPAddress *postto)
+{
+ get_reply_all (message, to, cc, postto);
+}
+
+
enum {
ATTRIB_UNKNOWN,
ATTRIB_CUSTOM,
@@ -2216,6 +2252,21 @@ struct _reply_data {
int mode;
};
+char *
+em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source)
+{
+ char *text, *credits;
+ ssize_t len = 0;
+ gboolean start_bottom = 0;
+
+ credits = attribution_format (ATTRIBUTION, message);
+ text = em_utils_message_to_html (message, credits, EM_FORMAT_QUOTE_CITE, &len, source, start_bottom ? "<BR>" : NULL);
+
+ g_free (credits);
+ return text;
+}
+
+
static void
reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
{
@@ -2246,7 +2297,7 @@ reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message
* may be supplied in order to update the message flags once it has
* been replied to.
**/
-void
+struct _EMsgComposer *
em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode, EMFormat *source)
{
CamelInternetAddress *to, *cc;
@@ -2266,10 +2317,10 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
g_object_ref(rd->source);
mail_get_message(folder, uid, reply_to_message, rd, mail_msg_unordered_push);
- return;
+ return NULL;
}
- g_return_if_fail(message != NULL);
+ g_return_val_if_fail(message != NULL, NULL);
/** @Event: message.replying
* @Title: Message being replied to
@@ -2324,5 +2375,8 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
composer_set_no_change (composer, TRUE, FALSE);
- gtk_widget_show (GTK_WIDGET (composer));
+ if (!e_msg_composer_get_lite())
+ gtk_widget_show (GTK_WIDGET (composer));
+
+ return composer;
}