aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-11-14 11:56:01 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-11-14 11:56:01 +0800
commit8c0bd86d5fdd6d87c3170e2a01423e7c7018a981 (patch)
tree22da2df051cb6f1bc988d15aca08ebb0a5baf7e4 /composer
parent6760cc72334346b8654fcd9fe1440890db55ac1b (diff)
downloadgsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.gz
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.zst
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.zip
Rearranged some of the addressbook code to try and eliminate some circular
dependencies in our libraries. The circular dependency between the composer and the mail module is still causing me headaches. And it doesn't help that the addressbook and calendar also want to link to the composer. svn path=/branches/kill-bonobo/; revision=36782
Diffstat (limited to 'composer')
-rw-r--r--composer/Makefile.am2
-rw-r--r--composer/e-msg-composer.c37
-rw-r--r--composer/e-msg-composer.h4
3 files changed, 38 insertions, 5 deletions
diff --git a/composer/Makefile.am b/composer/Makefile.am
index 4b46b3eb54..ee5ffe1259 100644
--- a/composer/Makefile.am
+++ b/composer/Makefile.am
@@ -47,7 +47,7 @@ libcomposer_la_SOURCES = \
e-msg-composer.c \
e-msg-composer.h
-libcomposer_la_LIBADD = \
+libcomposer_la_LIBADD = \
$(top_builddir)/widgets/misc/libemiscwidgets.la
uidir = $(evolutionuidir)
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0efcbfcbe9..36b6479fbf 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -69,8 +69,8 @@
#include "e-util/e-util.h"
#include <mail/em-event.h>
#include "e-signature-combo-box.h"
+#include "shell/e-shell.h"
-#include <camel/camel-session.h>
#include <camel/camel-charset-map.h>
#include <camel/camel-iconv.h>
#include <camel/camel-stream-filter.h>
@@ -94,7 +94,6 @@
#include "mail/mail-crypto.h"
#include "mail/mail-mt.h"
#include "mail/mail-ops.h"
-#include "mail/mail-session.h"
#include "mail/mail-tools.h"
#include "e-msg-composer.h"
@@ -875,7 +874,9 @@ build_message (EMsgComposer *composer,
if (smime_sign) {
CamelMimePart *npart = camel_mime_part_new ();
+ CamelSession *session;
+ session = e_msg_composer_get_session (composer);
cipher = camel_smime_context_new (session);
/* if we're also encrypting, envelope-sign rather than clear-sign */
@@ -899,10 +900,13 @@ build_message (EMsgComposer *composer,
}
if (smime_encrypt) {
+ CamelSession *session;
+
/* check to see if we should encrypt to self, NB removed after use */
if (account->smime_encrypt_to_self)
g_ptr_array_add (recipients, g_strdup (account->smime_encrypt_key));
+ session = e_msg_composer_get_session (composer);
cipher = camel_smime_context_new (session);
camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
@@ -2932,6 +2936,7 @@ create_composer (gint visible_mask)
/**
* 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.
@@ -2940,7 +2945,7 @@ create_composer (gint visible_mask)
**/
EMsgComposer *
-e_msg_composer_new_with_type (int type)
+e_msg_composer_new_with_type (gint type)
{
EMsgComposer *composer;
gint visible_mask;
@@ -3750,6 +3755,32 @@ e_msg_composer_new_redirect (CamelMimeMessage *message,
}
/**
+ * e_msg_composer_get_session:
+ * @composer: an #EMsgComposer
+ *
+ * Returns the mail module's global #CamelSession instance. Calling
+ * this function will load the mail module if it isn't already loaded.
+ *
+ * Returns: the mail module's #CamelSession
+ **/
+CamelSession *
+e_msg_composer_get_session (EMsgComposer *composer)
+{
+ EShellModule *shell_module;
+ CamelSession *session;
+ EShell *shell;
+
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
+
+ shell = e_shell_get_default ();
+ shell_module = e_shell_get_module_by_name (shell, "mail");
+ session = g_object_get_data (G_OBJECT (shell_module), "session");
+ g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+
+ return session;
+}
+
+/**
* e_msg_composer_send:
* @composer: an #EMsgComposer
*
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index f0ef682999..7303069bc9 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -25,6 +25,7 @@
#include <camel/camel-internet-address.h>
#include <camel/camel-mime-message.h>
+#include <camel/camel-session.h>
#include <libedataserver/e-account.h>
#include <libebook/e-destination.h>
#include <gtkhtml-editor.h>
@@ -78,6 +79,7 @@ EMsgComposer * e_msg_composer_new_with_message (CamelMimeMessage *msg);
EMsgComposer * e_msg_composer_new_from_url (const gchar *url);
EMsgComposer * e_msg_composer_new_redirect (CamelMimeMessage *message,
const gchar *resent_from);
+CamelSession * e_msg_composer_get_session (EMsgComposer *composer);
void e_msg_composer_send (EMsgComposer *composer);
void e_msg_composer_save_draft (EMsgComposer *composer);
@@ -155,7 +157,7 @@ struct _EAttachmentBar *
e_msg_composer_get_attachment_bar
(EMsgComposer *composer);
-gboolean e_msg_composer_is_exiting (EMsgComposer *composer);
+gboolean e_msg_composer_is_exiting (EMsgComposer *composer);
G_END_DECLS