[anjal] Port anjal for master. Move module code to Anjal by mbarnes



commit ef988dbdf3d48591c865b91f54b3bb2d6bbdc99f
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Wed Dec 23 14:42:29 2009 +0530

    Port anjal for master. Move module code to Anjal by mbarnes

 configure.ac                           |  275 +++++++++++++++++-
 src/Makefile.am                        |    7 +-
 src/mail-shell.c                       |   17 +-
 src/mail-view.c                        |    4 +-
 src/module/Makefile.am                 |   11 +-
 src/module/anjal-shell-backend.c       |   52 +++-
 src/module/anjal-shell-content.c       |    7 +-
 src/module/anjal-shell-view-actions.c  |   23 ++-
 src/module/anjal-shell-view-private.c  |   10 +-
 src/module/anjal-shell-view.c          |   14 +-
 src/module/e-mail-attachment-handler.c |  525 ++++++++++++++++++++++++++++++++
 src/module/e-mail-attachment-handler.h |   67 ++++
 src/module/e-mail-config-hook.c        |   73 +++++
 src/module/e-mail-config-hook.h        |   33 ++
 src/module/e-mail-event-hook.c         |   97 ++++++
 src/module/e-mail-event-hook.h         |   33 ++
 src/module/e-mail-junk-hook.c          |  325 ++++++++++++++++++++
 src/module/e-mail-junk-hook.h          |   66 ++++
 src/module/e-mail-shell-settings.c     |  237 ++++++++++++++
 src/module/e-mail-shell-settings.h     |   33 ++
 src/module/evolution-module-anjal.c    |   71 +++++
 21 files changed, 1953 insertions(+), 27 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2131064..e622b22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,8 +29,6 @@ AC_SUBST(privlibdir)
 imagesdir="$privdatadir/images"
 AC_SUBST(imagesdir)
 
-moduledir="$privlibdir/modules"
-AC_SUBST(moduledir)
 
 evolutioncomponentdir=`pkg-config --variable=componentdir evolution-shell`
 AC_SUBST(evolutioncomponentdir)
@@ -39,7 +37,8 @@ AC_SUBST(evolutionmoduledir)
 evolutionprivdir=`pkg-config --variable=privlibdir evolution-shell`
 AC_SUBST(evolutionprivdir)
 
-
+moduledir="$evolutionprivdir/anjal"
+AC_SUBST(moduledir)
 
 evolutiondatadir=`pkg-config --variable=datadir evolution-shell`
 AC_SUBST(evolutiondatadir)
@@ -57,7 +56,277 @@ IT_PROG_INTLTOOL([0.35.0])
 
 AM_PROG_LIBTOOL
 
+dnl ********************************************************************************
+dnl security extension support (SSL and S/MIME)
+dnl
+dnl The following voodoo does detection of mozilla libraries (nspr and nss)
+dnl needed by Camel (SSL and S/MIME).
+dnl
+dnl The Evolution security extensions are only built if these libraries are found
+dnl ********************************************************************************
+msg_ssl="no"
+msg_smime="no"
+
+dnl these 2 enable's are inverses of each other
+
+AC_ARG_ENABLE([nss],
+	AS_HELP_STRING([--enable-nss=@<:@yes/no/static@:>@],
+	[Attempt to use Mozilla libnss for SSL support.]),
+	[enable_nss=$enableval],[enable_nss=yes])
+
+AC_ARG_ENABLE([smime],
+	AS_HELP_STRING([--enable-smime],
+	[Attempt to use Mozilla libnss for SMIME support (this requires --enable-nss)]),
+	[enable_smime=$enableval],[enable_smime=yes])
+
+AC_ARG_WITH([nspr-includes],
+	AS_HELP_STRING([--with-nspr-includes=PATH],
+	[Location of Mozilla nspr4 includes.]))
+
+AC_ARG_WITH([nspr-libs],
+	AS_HELP_STRING([--with-nspr-libs=PATH],
+	[Location of Mozilla nspr4 libs.]))
+
+AC_ARG_WITH([nss-includes],
+	AS_HELP_STRING([--with-nss-includes=PATH],
+	[Location of Mozilla nss3 includes.]))
+
+AC_ARG_WITH([nss-libs],
+	AS_HELP_STRING([--with-nss-libs=PATH],
+	[Location of Mozilla nss3 libs.]))
+
+if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
+	if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}" || test "x${enable_nss}" = "xstatic"; then
+		check_manually="yes"
+	else
+		check_manually="no"
+	fi
+
+	if test "x${check_manually}" = "xno"; then
+		AC_MSG_CHECKING([Mozilla NSPR pkg-config module name])
+		mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
+		for pc in $mozilla_nspr_pcs; do
+			if $PKG_CONFIG --exists $pc; then
+				AC_MSG_RESULT([$pc])
+				mozilla_nspr=$pc
+				break;
+			fi
+		done
+
+		AC_MSG_CHECKING([Mozilla NSS pkg-config module name])
+		mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
+		for pc in $mozilla_nss_pcs; do
+			if $PKG_CONFIG --exists $pc; then
+				AC_MSG_RESULT([$pc])
+				mozilla_nss=$pc
+				break;
+			fi
+		done
+
+		if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
+			msg_ssl="yes (Mozilla NSS)"
+			if test "x$enable_smime" = "xyes"; then
+				AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
+				msg_smime="yes (Mozilla NSS)"
+			fi
+#			AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
+			AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
+			AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"`$PKG_CONFIG --variable=libdir $mozilla_nss`",[Define to the full path of mozilla nss library])
+			MANUAL_NSPR_CFLAGS=""
+			MANUAL_NSPR_LIBS=""
+			MANUAL_NSS_CFLAGS=""
+			MANUAL_NSS_LIBS=""
+		else
+			check_manually="yes"
+			mozilla_nspr=""
+			mozilla_nss=""
+		fi
+	fi
+
+	if test "x${check_manually}" = "xyes"; then
+		mozilla_nss=""
+		have_nspr_includes="no"
+		if test "x${with_nspr_includes}" != "xno"; then
+			CPPFLAGS_save="$CPPFLAGS"
+
+			AC_MSG_CHECKING([for Mozilla nspr4 includes in $with_nspr_includes])
+			AC_MSG_RESULT([""])
+
+			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
+			AC_CHECK_HEADERS([nspr.h prio.h],[ moz_nspr_includes="yes" ],,
+			[[
+				#if HAVE_NSPR_H
+				#include <nspr.h>
+				#include <prio.h>
+				#endif
+			]])
+			CPPFLAGS="$CPPFLAGS_save"
+
+			if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then
+				have_nspr_includes="yes"
+				MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
+			fi
+		else
+			AC_MSG_CHECKING([for Mozilla nspr4 includes])
+			AC_MSG_RESULT([no])
+		fi
+
+		have_nspr_libs="no"
+		if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then
+			CFLAGS_save="$CFLAGS"
+			LDFLAGS_save="$LDFLAGS"
+
+			if test "$enable_nss" = "static"; then
+				if test -z "${with_nspr_libs}"; then
+					AC_MSG_ERROR([Static linkage requested, but path to nspr libraries not set.]
+					[Please specify the path to libnspr4.a]
+					[Example: --with-nspr-libs=/usr/lib])
+				else
+					nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
+				fi
+			else
+				nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
+			fi
+
+			AC_CACHE_CHECK([for Mozilla nspr libraries], [ac_cv_moz_nspr_libs],
+			[
+				LIBS_save="$LIBS"
+				CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
+
+				if test "x${with_nspr_libs}" != "x"; then
+					LIBS="$nsprlibs"
+					LDFLAGS="$LDFLAGS -L$with_nspr_libs"
+				else
+					LIBS="$nsprlibs"
+					LDFLAGS="$LDFLAGS"
+				fi
+
+				AC_LINK_IFELSE([AC_LANG_CALL([], [PR_Init])],
+				[ac_cv_moz_nspr_libs="yes"], [ac_cv_moz_nspr_libs="no"])
+				CFLAGS="$CFLAGS_save"
+				LDFLAGS="$LDFLAGS_save"
+				LIBS="$LIBS_save"
+			])
+			if test "x$ac_cv_moz_nspr_libs" != "xno"; then
+				have_nspr_libs="yes"
+				MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
+			else
+				MANUAL_NSPR_CLFAGS=""
+			fi
+		else
+			AC_MSG_CHECKING([for Mozilla nspr4 libraries])
+			AC_MSG_RESULT([no])
+		fi
+
+		if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then
+			CPPFLAGS_save="$CPPFLAGS"
+
+			AC_MSG_CHECKING([for Mozilla nss3 includes in $with_nss_includes])
+			AC_MSG_RESULT([""])
+
+			if test "x${with_nspr_includes}" != "x"; then
+				CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
+			else
+				CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
+			fi
+
+			AC_CHECK_HEADERS(nss.h ssl.h smime.h,
+				[ have_nss_includes="yes" ],
+				[ have_nss_includes="no" ],
+				[
+					#if HAVE_NSPR_H
+					#include <nss.h>
+					#include <ssl.h>
+					#include <smime.h>
+					#endif
+				])
+
+			CPPFLAGS="$CPPFLAGS_save"
+
+			if test "x${have_nss_includes}" = "xyes"; then
+				have_nss_includes="yes"
+				MANUAL_NSS_CFLAGS="-I$with_nss_includes"
+			else
+				MANUAL_NSPR_CFLAGS=""
+				MANUAL_NSPR_LIBS=""
+			fi
+		else
+			AC_MSG_CHECKING([for Mozilla nss3 includes])
+			AC_MSG_RESULT([no])
+		fi
+
+		if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then
+			LDFLAGS_save="$LDFLAGS"
+
+			if test "$enable_nss" = "static"; then
+				if test -z "${with_nss_libs}"; then
+					AC_MSG_ERROR([Static linkage requested, but path to nss libraries not set.]
+					[Please specify the path to libnss3.a]
+					[Example: --with-nspr-libs=/usr/lib/mozilla])
+				else
+					nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a"
+					case "$host" in
+						*solaris*)
+						nsslibs="$nsslibs $with_nss_libs/libfreebl.a"
+					;;
+					esac
+				fi
+			else
+				nsslibs="-lssl3 -lsmime3 -lnss3"
+			fi
+
+			AC_CACHE_CHECK([for Mozilla nss libraries], [ac_cv_moz_nss_libs],
+			[
+				LIBS_save="$LIBS"
+				LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
+				LIBS="$nsslibs $nsprlibs"
+				AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])],
+				[ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"])
+				if test "$ac_cv_moz_nss_libs" = no; then
+					nsslibs="-lssl3 -lsmime3 -lnss3"
+					LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
+					AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])],
+					[ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"])
+				fi
+				LDFLAGS="$LDFLAGS_save"
+				LIBS="$LIBS_save"
+			])
+			if test "$ac_cv_moz_nss_libs" != no; then
+#				AC_DEFINE(HAVE_NSS)
+				AC_DEFINE(HAVE_SSL)
+				AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"$with_nss_libs", [Define to the full path of mozilla nss library])
+				if test "$enable_nss" = "static"; then
+					msg_ssl="yes (Mozilla NSS:static)"
+				else
+					msg_ssl="yes (Mozilla NSS)"
+				fi
+				dnl static_nss
+				if test "$enable_smime" = "yes"; then
+					AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
+					msg_smime="yes (Mozilla NSS)"
+				fi
+				MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
+			else
+				MANUAL_NSS_CFLAGS=""
+				MANUAL_NSPR_CFLAGS=""
+				MANUAL_NSPR_LIBS=""
+			fi
+		else
+			AC_MSG_CHECKING([for Mozilla nss libraries])
+			AC_MSG_RESULT([no])
+		fi
+
+		MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
+		MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
+	fi
+fi
+
+AM_CONDITIONAL(ENABLE_SMIME, [test "x$msg_smime" != "xno"])
 
+AC_SUBST(MANUAL_NSPR_CFLAGS)
+AC_SUBST(MANUAL_NSPR_LIBS)
+AC_SUBST(MANUAL_NSS_CFLAGS)
+AC_SUBST(MANUAL_NSS_LIBS)
 
 PKG_CHECK_MODULES(ANJAL, [gtk+-2.0 >= 2.8 libglade-2.0 >= 2.6.0 glib-2.0 gconf-2.0 libedataserver-1.2 libedataserverui-1.2 libebook-1.2 camel-1.2 evolution-mail >= 2.29.4 evolution-plugin libxml-2.0 sqlite3 libgtkhtml-3.14 gtkhtml-editor dbus-1])
 EVO_VERSION="`$PKG_CONFIG --variable=execversion evolution-shell`"
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d657db..a34e60c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,7 +15,9 @@ AM_CPPFLAGS = \
 	$(MOZILLA_CFLAGS) \
 	$(WEBKIT_CFLAGS) \
 	$(UNIQUE_CFLAGS) \
-	$(ANERLEY_CFLAGS)
+	$(ANERLEY_CFLAGS) \
+	$(MANUAL_NSPR_CFLAGS) \
+	$(MANUAL_NSS_CFLAGS)
 
 AM_CFLAGS =\
 	 -Wall\
@@ -101,8 +103,11 @@ anjal_LDADD = $(ANJAL_LIBS) \
 	$(WEBKIT_LIBS) \
 	$(UNIQUE_LIBS) \
 	$(ANERLEY_LIBS) \
+	$(MANUAL_NSPR_LIBS) \
+	$(MANUAL_NSS_LIBS) \
 	-lemiscwidgets \
 	-lfilter \
+	$(top_builddir)/src/module/libeshell-module-anjal.la		\	
 	-L"$(evolutionprivdir)/anjal"
 
 #-lefilterbar 
diff --git a/src/mail-shell.c b/src/mail-shell.c
index cb4dd37..1783cb8 100644
--- a/src/mail-shell.c
+++ b/src/mail-shell.c
@@ -220,7 +220,13 @@ idle_cb (EShellWindow *eshell)
 	mail_view_set_sort_by (view, priv->sort);
 	mail_view_set_check_email (view, priv->check_mail);
 
-	gtk_box_pack_start ((GtkBox *)priv->search_box, priv->search_entry, TRUE, FALSE, 0);
+	gtk_widget_unparent (priv->search_entry);
+	gtk_box_pack_start ((GtkBox *)priv->search_box, priv->search_entry, TRUE, TRUE, 0);
+	gtk_widget_show_all (priv->search_box);
+	e_shell_searchbar_set_filter_visible (priv->search_entry, FALSE);
+	e_shell_searchbar_set_scope_visible (priv->search_entry, FALSE);
+	e_shell_searchbar_set_label_visible (priv->search_entry, FALSE);
+
 //	anjal_shell_content_set_view (e_shell_view_get_shell_content(shell_view), view);
 //	gtk_container_add (e_shell_view_get_shell_content(shell_view), view);
 	anjal_shell_content_pack_view (e_shell_view_get_shell_content(shell_view), view);
@@ -249,15 +255,14 @@ idle_cb (EShellWindow *eshell)
 	return FALSE;
 }
 
-static void
-ms_construct_toolbar (EShellWindow *eshell, GtkWidget *container)
+static GtkWidget *
+ms_construct_toolbar (EShellWindow *eshell)
 {
 	MailShell *shell = (MailShell *)eshell;
 	MailShellPrivate *priv = shell->priv;
 	GtkWidget *box, *tmp, *lbl, *ar1;
 	
 	priv->top_bar = gtk_toolbar_new ();
-	gtk_box_pack_start ((GtkBox *)container, priv->top_bar, FALSE, FALSE, 0);
 	gtk_widget_show_all (priv->top_bar);
 	if (g_getenv("ANJAL_NO_MAX") || windowed) {
 		gtk_container_set_border_width (GTK_CONTAINER (shell), 1);
@@ -369,6 +374,8 @@ ms_construct_toolbar (EShellWindow *eshell, GtkWidget *container)
 	g_signal_connect (priv->quit, "clicked", G_CALLBACK(mail_shell_quit_cb), shell);
 	
 	g_idle_add ((GSourceFunc)idle_cb, shell);
+
+	return priv->top_bar;
 }
 
 
@@ -477,8 +484,8 @@ mail_shell_class_init (MailShellClass *klass)
 	object_class->finalize = mail_shell_finalize;
 	//shell_class->construct_content_area = ms_construct_content_area;
 	shell_class->construct_toolbar = ms_construct_toolbar;
+	shell_class->construct_menubar = NULL;
 	object_class->constructed = ms_constructed;
-
 //	klass->backspace_pressed = ms_backspace_pressed;
 //	klass->ctrl_w_pressed = ms_ctrl_w_pressed;
 //	klass->slash_pressed = ms_slash_pressed;
diff --git a/src/mail-view.c b/src/mail-view.c
index 7f9e4c9..6a92043 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -39,7 +39,7 @@
 #include "mail-account-view.h"
 #include "mail-search.h"
 #include "mail/em-folder-tree.h"
-
+#include <shell/e-shell-searchbar.h>
 
 struct  _MailViewPrivate {
 
@@ -798,7 +798,7 @@ mail_view_set_search (MailView *mv, const char *search)
 	if (child->type == MAIL_VIEW_FOLDER) {
 		MailFolderView *mfv = (MailFolderView *)child;
 
-		mail_folder_view_set_search (mfv, search, gtk_entry_get_text ((GtkEntry *)mv->priv->search_entry));
+		mail_folder_view_set_search (mfv, search, e_shell_searchbar_get_search_text ((EShellSearchbar *)mv->priv->search_entry));
 	}
 }
 
diff --git a/src/module/Makefile.am b/src/module/Makefile.am
index b8a4f80..3105ef7 100644
--- a/src/module/Makefile.am
+++ b/src/module/Makefile.am
@@ -16,10 +16,17 @@ libeshell_module_anjal_la_SOURCES =					\
 	anjal-shell-view-actions.c					\
 	anjal-shell-view-actions.h					\
 	anjal-shell-view-private.c					\
-	anjal-shell-view-private.h
+	anjal-shell-view-private.h					\
+	e-mail-config-hook.c						\
+	e-mail-event-hook.c						\
+	e-mail-junk-hook.c						\
+	evolution-module-anjal.c					\
+	e-mail-attachment-handler.c					\
+	e-mail-shell-settings.c					
 
 libeshell_module_anjal_la_LIBADD =					\
-	$(ANJAL_LIBS)
+	$(ANJAL_LIBS)							\
+	-levolution-mail-importers
 
 libeshell_module_anjal_la_LDFLAGS =					\
 	-avoid-version -module
diff --git a/src/module/anjal-shell-backend.c b/src/module/anjal-shell-backend.c
index 97ad5e4..b492471 100644
--- a/src/module/anjal-shell-backend.c
+++ b/src/module/anjal-shell-backend.c
@@ -351,6 +351,9 @@ anjal_shell_backend_constructed (GObject *object)
 		G_CALLBACK (anjal_shell_backend_window_created_cb),
 		shell_backend);
 
+	mail_config_init ();
+	mail_msg_init ();
+
 	custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
 	e_mail_store_init (custom_dir);
 	g_free (custom_dir);
@@ -372,7 +375,7 @@ anjal_shell_backend_start (EShellBackend *shell_backend)
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	/* XXX Do we really still need this flag? */
-	mail_session_set_interactive (TRUE);
+	//mail_session_set_interactive (TRUE);
 
 	enable_search_folders = e_shell_settings_get_boolean (
 		shell_settings, "mail-enable-search-folders");
@@ -444,3 +447,50 @@ anjal_shell_backend_register_type (GTypeModule *type_module)
 		"AnjalShellBackend", &type_info, 0);
 }
 
+/******************* Code below here belongs elsewhere. *******************/
+
+#include "filter/e-filter-option.h"
+#include "shell/e-shell-settings.h"
+#include "mail/e-mail-label-list-store.h"
+
+GSList *
+e_mail_labels_get_filter_options (void)
+{
+	EShell *shell;
+	EShellSettings *shell_settings;
+	EMailLabelListStore *list_store;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	GSList *list = NULL;
+	gboolean valid;
+
+	shell = e_shell_get_default ();
+	shell_settings = e_shell_get_shell_settings (shell);
+	list_store = e_shell_settings_get_object (
+		shell_settings, "mail-label-list-store");
+
+	model = GTK_TREE_MODEL (list_store);
+	valid = gtk_tree_model_get_iter_first (model, &iter);
+
+	while (valid) {
+		struct _filter_option *option;
+		gchar *name, *tag;
+
+		name = e_mail_label_list_store_get_name (list_store, &iter);
+		tag = e_mail_label_list_store_get_tag (list_store, &iter);
+
+		option = g_new0 (struct _filter_option, 1);
+		option->title = e_str_without_underscores (name);
+		option->value = tag;  /* takes ownership */
+		list = g_slist_prepend (list, option);
+
+		g_free (name);
+
+		valid = gtk_tree_model_iter_next (model, &iter);
+	}
+
+	g_object_unref (list_store);
+
+	return g_slist_reverse (list);
+}
+
diff --git a/src/module/anjal-shell-content.c b/src/module/anjal-shell-content.c
index 3463b2e..bd183d6 100644
--- a/src/module/anjal-shell-content.c
+++ b/src/module/anjal-shell-content.c
@@ -140,6 +140,8 @@ anjal_shell_content_constructed (GObject *object)
 	priv->view_box = gtk_vbox_new (FALSE, 0);
 	gtk_container_add (GTK_CONTAINER (container), priv->view_box);
 	gtk_widget_show (priv->view_box);
+	
+	priv->search_entry = e_shell_content_get_searchbar (shell_content);
 
 }
 
@@ -209,7 +211,7 @@ anjal_shell_content_class_init (AnjalShellContentClass *class)
 
 	shell_content_class = E_SHELL_CONTENT_CLASS (class);
 	shell_content_class->check_state = anjal_shell_content_check_state;
-	shell_content_class->construct_searchbar = NULL;
+	//shell_content_class->construct_searchbar = NULL;
 
 	g_object_class_install_property (
 		object_class,
@@ -229,9 +231,6 @@ anjal_shell_content_init (AnjalShellContent *mail_shell_content)
 	mail_shell_content->priv =
 		ANJAL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content);
 
-	/* XXX This might be better kept elsewhere. */
-	mail_shell_content->priv->search_entry = e_hinted_entry_new ();
-
 	/* Postpone widget construction until we have a shell view. */
 }
 
diff --git a/src/module/anjal-shell-view-actions.c b/src/module/anjal-shell-view-actions.c
index 4363b24..8875082 100644
--- a/src/module/anjal-shell-view-actions.c
+++ b/src/module/anjal-shell-view-actions.c
@@ -725,6 +725,20 @@ static GtkActionEntry mail_entries[] = {
 	  NULL,
 	  NULL },
 
+	{ "mail-popup-flag-completed",
+	  NULL,
+	  N_("Followup"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-flag-clear",
+	  NULL,
+	  N_("Followup"),
+	  NULL,
+	  NULL,
+	  NULL },
+
 	{ "mail-filter-on-subject",
 	  NULL,
 	  N_("Filter"),
@@ -787,6 +801,13 @@ static GtkActionEntry mail_entries[] = {
 	  NULL,
 	  NULL,
 	  NULL },
+
+	{ "mail-search-advanced-hidden",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
 };
 
 static EPopupActionEntry mail_popup_entries[] = {
@@ -1059,7 +1080,7 @@ anjal_shell_view_actions_init (AnjalShellView *mail_shell_view)
 	radio_action = GTK_RADIO_ACTION (ACTION (MAIL_SCOPE_CURRENT_FOLDER));
 	e_shell_content_set_scope_action (shell_content, radio_action);
 	*/
-	e_shell_content_set_scope_visible (shell_content, FALSE);
+	//e_shell_content_set_scope_visible (shell_content, FALSE);
 
 }
 
diff --git a/src/module/anjal-shell-view-private.c b/src/module/anjal-shell-view-private.c
index 19dbbde..a40beb8 100644
--- a/src/module/anjal-shell-view-private.c
+++ b/src/module/anjal-shell-view-private.c
@@ -20,6 +20,7 @@
  */
 
 #include "anjal-shell-view-private.h"
+#include <shell/e-shell-searchbar.h>
 
 static void
 mail_shell_view_folder_tree_selected_cb (AnjalShellView *mail_shell_view,
@@ -239,14 +240,14 @@ anjal_shell_view_private_constructed (AnjalShellView *mail_shell_view)
 	/* Populate built-in rules for search entry popup menu.
 	 * Keep the assertions, please.  If the conditions aren't
 	 * met we're going to crash anyway, just more mysteriously. */
-	context = e_shell_content_get_search_context (shell_content);
+	context = E_SHELL_VIEW_GET_CLASS (shell_view)->search_context;
 	source = E_FILTER_SOURCE_DEMAND;
 	while ((rule = e_rule_context_next_rule (context, rule, source))) {
 		g_assert (ii < MAIL_NUM_SEARCH_RULES);
 		priv->search_rules[ii++] = g_object_ref (rule);
 	}
 	g_assert (ii == MAIL_NUM_SEARCH_RULES);
-
+	
 	/* Now that we're all set up, simulate selecting a folder. */
 	g_signal_emit_by_name (selection, "changed");
 }
@@ -277,6 +278,7 @@ anjal_shell_view_restore_state (AnjalShellView *mail_shell_view, const char *fol
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	gchar *group_name;
+	EShellSearchbar *searchbar;
 
 	/* XXX Move this to EMailShellContent. */
 
@@ -285,8 +287,10 @@ anjal_shell_view_restore_state (AnjalShellView *mail_shell_view, const char *fol
 	shell_view = E_SHELL_VIEW (mail_shell_view);
 	shell_content = e_shell_view_get_shell_content (shell_view);
 
+	searchbar = e_shell_content_get_searchbar (shell_content);
+
 	group_name = g_strdup_printf ("Folder %s", folder_uri);
-	e_shell_content_restore_state (shell_content, group_name);
+	e_shell_searchbar_restore_state (searchbar, group_name);
 	g_free (group_name);
 }
 
diff --git a/src/module/anjal-shell-view.c b/src/module/anjal-shell-view.c
index f4976b7..c6db60d 100644
--- a/src/module/anjal-shell-view.c
+++ b/src/module/anjal-shell-view.c
@@ -20,6 +20,7 @@
  */
 
 #include "anjal-shell-view-private.h"
+#include <shell/e-shell-searchbar.h>
 
 static gpointer parent_class;
 static GType anjal_shell_view_type;
@@ -87,7 +88,8 @@ anjal_shell_view_execute_search (EShellView *shell_view)
 	EShellSidebar *shell_sidebar;
 	AnjalShellSidebar *mail_shell_sidebar;
 	EMFolderTree *folder_tree;
-
+	EShellSearchbar *searchbar;
+	
 	mail_shell_sidebar = anjal_shell_view->priv->mail_shell_sidebar;
 	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
 
@@ -104,7 +106,7 @@ anjal_shell_view_execute_search (EShellView *shell_view)
 	shell_settings = e_shell_get_shell_settings (shell);
 
 	mail_shell_content = ANJAL_SHELL_CONTENT (shell_content);
-
+	searchbar = e_shell_content_get_searchbar (shell_content);
 	if (folder_uri != NULL) {
 		GKeyFile *key_file;
 		const gchar *key;
@@ -114,7 +116,7 @@ anjal_shell_view_execute_search (EShellView *shell_view)
 		key_file = e_shell_view_get_state_key_file (shell_view);
 
 		key = STATE_KEY_SEARCH_TEXT;
-		string = e_shell_content_get_search_text (shell_content);
+		string = e_shell_searchbar_get_search_text (searchbar);
 		group_name = g_strdup_printf ("Folder %s", folder_uri);
 
 		if (string != NULL && *string != '\0')
@@ -131,7 +133,7 @@ anjal_shell_view_execute_search (EShellView *shell_view)
 	model = e_shell_settings_get_object (
 		shell_settings, "mail-label-list-store");
 
-	text = e_shell_content_get_search_text (shell_content);
+	text = e_shell_searchbar_get_search_text (searchbar);
 	if (text == NULL || *text == '\0') {
 		query = g_strdup ("");
 		goto filter;
@@ -145,6 +147,8 @@ anjal_shell_view_execute_search (EShellView *shell_view)
 	g_return_if_fail (value >= 0 && value < MAIL_NUM_SEARCH_RULES);
 	rule = priv->search_rules[value];
 
+	e_shell_view_set_search_rule (shell_view, rule);
+
 	for (iter = rule->parts; iter != NULL; iter = iter->next) {
 		EFilterPart *part = iter->data;
 		EFilterElement *element = NULL;
@@ -311,7 +315,6 @@ filter:
 			query = temp;
 			break;
 	}
-#endif
 
 	search_rule = e_shell_content_get_search_rule (shell_content);
 	if (search_rule != NULL) {
@@ -324,6 +327,7 @@ filter:
 
 		g_string_free (string, TRUE);
 	}
+#endif
 
 	if (anjal_shell_view->priv->view)
 		anjal_mail_view_set_search (anjal_shell_view->priv->view, query);
diff --git a/src/module/e-mail-attachment-handler.c b/src/module/e-mail-attachment-handler.c
new file mode 100644
index 0000000..e00ba9d
--- /dev/null
+++ b/src/module/e-mail-attachment-handler.c
@@ -0,0 +1,525 @@
+/*
+ * e-mail-attachment-handler.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-attachment-handler.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-folder.h>
+#include <camel/camel-stream-mem.h>
+
+#include "e-util/e-alert-dialog.h"
+#include "mail/em-composer-utils.h"
+#include "mail/mail-tools.h"
+
+#define E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerPrivate))
+
+struct _EMailAttachmentHandlerPrivate {
+	gint placeholder;
+};
+
+static gpointer parent_class;
+static GType mail_attachment_handler_type;
+
+static const gchar *ui =
+"<ui>"
+"  <popup name='context'>"
+"    <placeholder name='custom-actions'>"
+"      <menuitem action='mail-reply-sender'/>"
+"      <menuitem action='mail-reply-all'/>"
+"      <menuitem action='mail-forward'/>"
+"    </placeholder>"
+"  </popup>"
+"</ui>";
+
+/* Note: Do not use the info field. */
+static GtkTargetEntry target_table[] = {
+	{ (gchar *) "message/rfc822",	0, 0 },
+	{ (gchar *) "x-uid-list",	0, 0 }
+};
+
+static void
+mail_attachment_handler_forward (GtkAction *action,
+                                 EAttachmentView *view)
+{
+	EAttachment *attachment;
+	CamelMimePart *mime_part;
+	CamelDataWrapper *wrapper;
+	GList *selected;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+	g_return_if_fail (g_list_length (selected) == 1);
+
+	attachment = E_ATTACHMENT (selected->data);
+	mime_part = e_attachment_get_mime_part (attachment);
+	wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+
+	em_utils_forward_message (CAMEL_MIME_MESSAGE (wrapper), NULL);
+
+	g_list_foreach (selected, (GFunc) g_object_unref, NULL);
+	g_list_free (selected);
+}
+
+static void
+mail_attachment_handler_reply_all (GtkAction *action,
+                                   EAttachmentView *view)
+{
+	EAttachment *attachment;
+	CamelMimePart *mime_part;
+	CamelDataWrapper *wrapper;
+	GList *selected;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+	g_return_if_fail (g_list_length (selected) == 1);
+
+	attachment = E_ATTACHMENT (selected->data);
+	mime_part = e_attachment_get_mime_part (attachment);
+	wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+
+	em_utils_reply_to_message (
+		NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
+		REPLY_MODE_ALL, NULL);
+
+	g_list_foreach (selected, (GFunc) g_object_unref, NULL);
+	g_list_free (selected);
+}
+
+static void
+mail_attachment_handler_reply_sender (GtkAction *action,
+                                      EAttachmentView *view)
+{
+	EAttachment *attachment;
+	CamelMimePart *mime_part;
+	CamelDataWrapper *wrapper;
+	GList *selected;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+	g_return_if_fail (g_list_length (selected) == 1);
+
+	attachment = E_ATTACHMENT (selected->data);
+	mime_part = e_attachment_get_mime_part (attachment);
+	wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+
+	em_utils_reply_to_message (
+		NULL, NULL, CAMEL_MIME_MESSAGE (wrapper),
+		REPLY_MODE_SENDER, NULL);
+
+	g_list_foreach (selected, (GFunc) g_object_unref, NULL);
+	g_list_free (selected);
+}
+
+static GtkActionEntry standard_entries[] = {
+
+	{ "mail-forward",
+	  "mail-forward",
+	  N_("_Forward"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (mail_attachment_handler_forward) },
+
+	{ "mail-reply-all",
+	  "mail-reply-all",
+	  N_("Reply to _All"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (mail_attachment_handler_reply_all) },
+
+	{ "mail-reply-sender",
+	  "mail-reply-sender",
+	  N_("_Reply to Sender"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (mail_attachment_handler_reply_sender) }
+};
+
+static void
+mail_attachment_handler_message_rfc822 (EAttachmentView *view,
+                                        GdkDragContext *drag_context,
+                                        gint x,
+                                        gint y,
+                                        GtkSelectionData *selection_data,
+                                        guint info,
+                                        guint time)
+{
+	static GdkAtom atom = GDK_NONE;
+	EAttachmentStore *store;
+	EAttachment *attachment;
+	CamelMimeMessage *message;
+	CamelDataWrapper *wrapper;
+	CamelStream *stream;
+	const gchar *data;
+	gboolean success = FALSE;
+	gpointer parent;
+	gint length;
+
+	if (G_UNLIKELY (atom == GDK_NONE))
+		atom = gdk_atom_intern_static_string ("message/rfc822");
+
+	if (gtk_selection_data_get_target (selection_data) != atom)
+		return;
+
+	g_signal_stop_emission_by_name (view, "drag-data-received");
+
+	data = (const gchar *) gtk_selection_data_get_data (selection_data);
+	length = gtk_selection_data_get_length (selection_data);
+
+	stream = camel_stream_mem_new ();
+	camel_stream_write (stream, data, length);
+	camel_stream_reset (stream);
+
+	message = camel_mime_message_new ();
+	wrapper = CAMEL_DATA_WRAPPER (message);
+
+	if (camel_data_wrapper_construct_from_stream (wrapper, stream) == -1)
+		goto exit;
+
+	store = e_attachment_view_get_store (view);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (view));
+	parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+	attachment = e_attachment_new_for_message (message);
+	e_attachment_store_add_attachment (store, attachment);
+	e_attachment_load_async (
+		attachment, (GAsyncReadyCallback)
+		e_attachment_load_handle_error, parent);
+	g_object_unref (attachment);
+
+	success = TRUE;
+
+exit:
+	camel_object_unref (message);
+	camel_object_unref (stream);
+
+	gtk_drag_finish (drag_context, success, FALSE, time);
+}
+
+static void
+mail_attachment_handler_x_uid_list (EAttachmentView *view,
+                                    GdkDragContext *drag_context,
+                                    gint x,
+                                    gint y,
+                                    GtkSelectionData *selection_data,
+                                    guint info,
+                                    guint time)
+{
+	static GdkAtom atom = GDK_NONE;
+	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
+	CamelDataWrapper *wrapper;
+	CamelMimeMessage *message;
+	CamelMultipart *multipart;
+	CamelMimePart *mime_part;
+	CamelFolder *folder = NULL;
+	EAttachment *attachment;
+	EAttachmentStore *store;
+	GPtrArray *uids;
+	const gchar *data;
+	const gchar *cp, *end;
+	gchar *description;
+	gpointer parent;
+	gint length;
+	guint ii;
+
+	if (G_UNLIKELY (atom == GDK_NONE))
+		atom = gdk_atom_intern_static_string ("x-uid-list");
+
+	if (gtk_selection_data_get_target (selection_data) != atom)
+		return;
+
+	store = e_attachment_view_get_store (view);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (view));
+	parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+	uids = g_ptr_array_new ();
+
+	data = (const gchar *) gtk_selection_data_get_data (selection_data);
+	length = gtk_selection_data_get_length (selection_data);
+
+	/* The UID list is delimited by NUL characters.
+	 * Brilliant.  So we can't use g_strsplit(). */
+
+	cp = data;
+	end = data + length;
+
+	while (cp < end) {
+		const gchar *start = cp;
+
+		while (cp < end && *cp != '\0')
+			cp++;
+
+		/* Skip the first string. */
+		if (start > data)
+			g_ptr_array_add (uids, g_strndup (start, cp - start));
+
+		cp++;
+	}
+
+	if (uids->len == 0)
+		goto exit;
+
+	/* The first string is the folder URI. */
+	folder = mail_tool_uri_to_folder (data, 0, &ex);
+	if (folder == NULL)
+		goto exit;
+
+	/* Handle one message. */
+	if (uids->len == 1) {
+		message = camel_folder_get_message (
+			folder, uids->pdata[0], &ex);
+		if (message == NULL)
+			goto exit;
+
+		attachment = e_attachment_new_for_message (message);
+		e_attachment_store_add_attachment (store, attachment);
+		e_attachment_load_async (
+			attachment, (GAsyncReadyCallback)
+			e_attachment_load_handle_error, parent);
+		g_object_unref (attachment);
+
+		camel_object_unref (message);
+		goto exit;
+	}
+
+	/* Build a multipart/digest message out of the UIDs. */
+
+	multipart = camel_multipart_new ();
+	wrapper = CAMEL_DATA_WRAPPER (multipart);
+	camel_data_wrapper_set_mime_type (wrapper, "multipart/digest");
+	camel_multipart_set_boundary (multipart, NULL);
+
+	for (ii = 0; ii < uids->len; ii++) {
+		message = camel_folder_get_message (
+			folder, uids->pdata[ii], &ex);
+		if (message == NULL) {
+			camel_object_unref (multipart);
+			goto exit;
+		}
+
+		mime_part = camel_mime_part_new ();
+		wrapper = CAMEL_DATA_WRAPPER (message);
+		camel_mime_part_set_disposition (mime_part, "inline");
+		camel_medium_set_content_object (
+			CAMEL_MEDIUM (mime_part), wrapper);
+		camel_mime_part_set_content_type (mime_part, "message/rfc822");
+		camel_multipart_add_part (multipart, mime_part);
+		camel_object_unref (mime_part);
+
+		camel_object_unref (message);
+	}
+
+	mime_part = camel_mime_part_new ();
+	wrapper = CAMEL_DATA_WRAPPER (multipart);
+	camel_medium_set_content_object (CAMEL_MEDIUM (mime_part), wrapper);
+
+	/* Translators: This is only for multiple messages. */
+	description = g_strdup_printf (_("%d attached messages"), uids->len);
+	camel_mime_part_set_description (mime_part, description);
+	g_free (description);
+
+	attachment = e_attachment_new ();
+	e_attachment_set_mime_part (attachment, mime_part);
+	e_attachment_store_add_attachment (store, attachment);
+	e_attachment_load_async (
+		attachment, (GAsyncReadyCallback)
+		e_attachment_load_handle_error, parent);
+	g_object_unref (attachment);
+
+	camel_object_unref (mime_part);
+	camel_object_unref (multipart);
+
+exit:
+	if (camel_exception_is_set (&ex)) {
+		gchar *folder_name;
+
+		if (folder != NULL)
+			camel_object_get (
+				folder, NULL, CAMEL_FOLDER_NAME,
+				&folder_name, NULL);
+		else
+			folder_name = g_strdup (data);
+
+		e_alert_run_dialog_for_args (
+			parent, "mail-composer:attach-nomessages",
+			folder_name, camel_exception_get_description (&ex),
+			NULL);
+
+		if (folder != NULL)
+			camel_object_free (
+				folder, CAMEL_FOLDER_NAME, folder_name);
+		else
+			g_free (folder_name);
+
+		camel_exception_clear (&ex);
+	}
+
+	if (folder != NULL)
+		camel_object_unref (folder);
+
+	g_ptr_array_free (uids, TRUE);
+
+	g_signal_stop_emission_by_name (view, "drag-data-received");
+}
+
+static void
+mail_attachment_handler_update_actions (EAttachmentView *view)
+{
+	EAttachment *attachment;
+	CamelMimePart *mime_part;
+	CamelDataWrapper *wrapper;
+	GtkActionGroup *action_group;
+	GList *selected;
+	gboolean visible = FALSE;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+
+	if (g_list_length (selected) != 1)
+		goto exit;
+
+	attachment = E_ATTACHMENT (selected->data);
+	mime_part = e_attachment_get_mime_part (attachment);
+
+	if (!CAMEL_IS_MIME_PART (mime_part))
+		goto exit;
+
+	wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+
+	visible = CAMEL_IS_MIME_MESSAGE (wrapper);
+
+exit:
+	action_group = e_attachment_view_get_action_group (view, "mail");
+	gtk_action_group_set_visible (action_group, visible);
+
+	g_list_foreach (selected, (GFunc) g_object_unref, NULL);
+	g_list_free (selected);
+}
+
+static void
+mail_attachment_handler_constructed (GObject *object)
+{
+	EAttachmentHandler *handler;
+	EAttachmentView *view;
+	GtkActionGroup *action_group;
+	GtkUIManager *ui_manager;
+	GError *error = NULL;
+
+	handler = E_ATTACHMENT_HANDLER (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (parent_class)->constructed (object);
+
+	view = e_attachment_handler_get_view (handler);
+
+	action_group = e_attachment_view_add_action_group (view, "mail");
+	gtk_action_group_add_actions (
+		action_group, standard_entries,
+		G_N_ELEMENTS (standard_entries), view);
+
+	ui_manager = e_attachment_view_get_ui_manager (view);
+	gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+
+	if (error != NULL) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+	}
+
+	g_signal_connect (
+		view, "update-actions",
+		G_CALLBACK (mail_attachment_handler_update_actions),
+		NULL);
+
+	g_signal_connect (
+		view, "drag-data-received",
+		G_CALLBACK (mail_attachment_handler_message_rfc822),
+		NULL);
+
+	g_signal_connect (
+		view, "drag-data-received",
+		G_CALLBACK (mail_attachment_handler_x_uid_list),
+		NULL);
+}
+
+static GdkDragAction
+mail_attachment_handler_get_drag_actions (EAttachmentHandler *handler)
+{
+	return GDK_ACTION_COPY;
+}
+
+static const GtkTargetEntry *
+mail_attachment_handler_get_target_table (EAttachmentHandler *handler,
+                                          guint *n_targets)
+{
+	if (n_targets != NULL)
+		*n_targets = G_N_ELEMENTS (target_table);
+
+	return target_table;
+}
+
+static void
+mail_attachment_handler_class_init (EMailAttachmentHandlerClass *class)
+{
+	GObjectClass *object_class;
+	EAttachmentHandlerClass *handler_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EMailAttachmentHandlerPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->constructed = mail_attachment_handler_constructed;
+
+	handler_class = E_ATTACHMENT_HANDLER_CLASS (class);
+	handler_class->get_drag_actions = mail_attachment_handler_get_drag_actions;
+	handler_class->get_target_table = mail_attachment_handler_get_target_table;
+}
+
+static void
+mail_attachment_handler_init (EMailAttachmentHandler *handler)
+{
+	handler->priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
+}
+
+GType
+e_mail_attachment_handler_get_type (void)
+{
+	return mail_attachment_handler_type;
+}
+
+void
+e_mail_attachment_handler_register_type (GTypeModule *type_module)
+{
+	static const GTypeInfo type_info = {
+		sizeof (EMailAttachmentHandlerClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) mail_attachment_handler_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (EMailAttachmentHandler),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) mail_attachment_handler_init,
+		NULL   /* value_table */
+	};
+
+	mail_attachment_handler_type = g_type_module_register_type (
+		type_module, E_TYPE_ATTACHMENT_HANDLER,
+		"EMailAttachmentHandler", &type_info, 0);
+}
diff --git a/src/module/e-mail-attachment-handler.h b/src/module/e-mail-attachment-handler.h
new file mode 100644
index 0000000..25fa5b6
--- /dev/null
+++ b/src/module/e-mail-attachment-handler.h
@@ -0,0 +1,67 @@
+/*
+ * e-mail-attachment-handler.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_ATTACHMENT_HANDLER_H
+#define E_MAIL_ATTACHMENT_HANDLER_H
+
+#include <misc/e-attachment-handler.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_ATTACHMENT_HANDLER \
+	(e_mail_attachment_handler_get_type ())
+#define E_MAIL_ATTACHMENT_HANDLER(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandler))
+#define E_MAIL_ATTACHMENT_HANDLER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerClass))
+#define E_IS_MAIL_ATTACHMENT_HANDLER(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER))
+#define E_IS_MAIL_ATTACHMENT_HANDLER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_MAIL_ATTACHMENT_HANDLER))
+#define E_MAIL_ATTACHMENT_HANDLER_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_MAIL_ATTACHMENT_HANDLER, EMailAttachmentHandlerClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailAttachmentHandler EMailAttachmentHandler;
+typedef struct _EMailAttachmentHandlerClass EMailAttachmentHandlerClass;
+typedef struct _EMailAttachmentHandlerPrivate EMailAttachmentHandlerPrivate;
+
+struct _EMailAttachmentHandler {
+	EAttachmentHandler parent;
+	EMailAttachmentHandlerPrivate *priv;
+};
+
+struct _EMailAttachmentHandlerClass {
+	EAttachmentHandlerClass parent_class;
+};
+
+GType		e_mail_attachment_handler_get_type	(void);
+void		e_mail_attachment_handler_register_type
+						(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_ATTACHMENT_HANDLER_H */
diff --git a/src/module/e-mail-config-hook.c b/src/module/e-mail-config-hook.c
new file mode 100644
index 0000000..def986f
--- /dev/null
+++ b/src/module/e-mail-config-hook.c
@@ -0,0 +1,73 @@
+/*
+ * e-mail-config-hook.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-config-hook.h"
+
+#include "e-util/e-config.h"
+#include "mail/em-config.h"
+
+static const EConfigHookTargetMask no_masks[] = {
+	{ NULL }
+};
+
+static const EConfigHookTargetMap targets[] = {
+	{ "folder", EM_CONFIG_TARGET_FOLDER, no_masks },
+	{ "prefs", EM_CONFIG_TARGET_PREFS, no_masks },
+	{ "account", EM_CONFIG_TARGET_ACCOUNT, no_masks },
+	{ NULL }
+};
+
+static void
+mail_config_hook_class_init (EConfigHookClass *class)
+{
+	EPluginHookClass *plugin_hook_class;
+	gint ii;
+
+	plugin_hook_class = E_PLUGIN_HOOK_CLASS (class);
+	plugin_hook_class->id = "org.gnome.evolution.mail.config:1.0";
+
+	class->config_class = g_type_class_ref (em_config_get_type ());
+
+	for (ii = 0; targets[ii].type != NULL; ii++)
+		e_config_hook_class_add_target_map (
+			(EConfigHookClass *) class, &targets[ii]);
+}
+
+void
+e_mail_config_hook_register_type (GTypeModule *type_module)
+{
+	const GTypeInfo type_info = {
+		sizeof (EConfigHookClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) mail_config_hook_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (EConfigHook),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) NULL,
+		NULL   /* value_table */
+	};
+
+	g_type_module_register_type (
+		type_module, e_config_hook_get_type (),
+		"EMailConfigHook", &type_info, 0);
+}
diff --git a/src/module/e-mail-config-hook.h b/src/module/e-mail-config-hook.h
new file mode 100644
index 0000000..e54ad81
--- /dev/null
+++ b/src/module/e-mail-config-hook.h
@@ -0,0 +1,33 @@
+/*
+ * e-mail-config-hook.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_HOOK_H
+#define E_MAIL_CONFIG_HOOK_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_config_hook_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_HOOK_H */
diff --git a/src/module/e-mail-event-hook.c b/src/module/e-mail-event-hook.c
new file mode 100644
index 0000000..becc806
--- /dev/null
+++ b/src/module/e-mail-event-hook.c
@@ -0,0 +1,97 @@
+/*
+ * e-mail-event-hook.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-event-hook.h"
+
+#include "e-util/e-event.h"
+#include "mail/em-event.h"
+
+static const EEventHookTargetMask folder_masks[] = {
+	{ "newmail", EM_EVENT_FOLDER_NEWMAIL },
+	{ NULL }
+};
+
+static const EEventHookTargetMask composer_masks[] = {
+	{ "sendoption", EM_EVENT_COMPOSER_SEND_OPTION },
+	{ NULL }
+};
+
+static const EEventHookTargetMask message_masks[] = {
+	{ "replyall", EM_EVENT_MESSAGE_REPLY_ALL },
+	{ "reply", EM_EVENT_MESSAGE_REPLY },
+	{ NULL }
+};
+
+static const EEventHookTargetMask send_receive_masks[] = {
+	{ "sendreceive", EM_EVENT_SEND_RECEIVE },
+	{ NULL }
+};
+
+static const EEventHookTargetMask custom_icon_masks[] = {
+	{ "customicon", EM_EVENT_CUSTOM_ICON },
+	{ NULL }
+};
+
+static const EEventHookTargetMap targets[] = {
+	{ "folder", EM_EVENT_TARGET_FOLDER, folder_masks },
+	{ "message", EM_EVENT_TARGET_MESSAGE, message_masks },
+	{ "composer", EM_EVENT_TARGET_COMPOSER, composer_masks },
+	{ "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, send_receive_masks },
+	{ "customicon", EM_EVENT_TARGET_CUSTOM_ICON, custom_icon_masks },
+	{ NULL }
+};
+
+static void
+mail_event_hook_class_init (EEventHookClass *class)
+{
+	EPluginHookClass *plugin_hook_class;
+	gint ii;
+
+	plugin_hook_class = E_PLUGIN_HOOK_CLASS (class);
+	plugin_hook_class->id = "org.gnome.evolution.mail.events:1.0";
+
+	class->event = (EEvent *) em_event_peek ();
+
+	for (ii = 0; targets[ii].type != NULL; ii++)
+		e_event_hook_class_add_target_map (
+			(EEventHookClass *) class, &targets[ii]);
+}
+
+void
+e_mail_event_hook_register_type (GTypeModule *type_module)
+{
+	const GTypeInfo type_info = {
+		sizeof (EEventHookClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) mail_event_hook_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (EEventHook),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) NULL,
+		NULL   /* value_table */
+	};
+
+	g_type_module_register_type (
+		type_module, e_event_hook_get_type (),
+		"EMailEventHook", &type_info, 0);
+}
diff --git a/src/module/e-mail-event-hook.h b/src/module/e-mail-event-hook.h
new file mode 100644
index 0000000..9cad43a
--- /dev/null
+++ b/src/module/e-mail-event-hook.h
@@ -0,0 +1,33 @@
+/*
+ * e-mail-event-hook.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_EVENT_HOOK_H
+#define E_MAIL_EVENT_HOOK_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+void e_mail_event_hook_register_type (GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_EVENT_HOOK_H */
diff --git a/src/module/e-mail-junk-hook.c b/src/module/e-mail-junk-hook.c
new file mode 100644
index 0000000..ccdcf0c
--- /dev/null
+++ b/src/module/e-mail-junk-hook.c
@@ -0,0 +1,325 @@
+/*
+ * e-mail-junk-hook.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-junk-hook.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-junk-plugin.h>
+
+#include "e-util/e-alert-dialog.h"
+#include "shell/e-shell.h"
+
+#include "mail/em-junk.h"
+#include "mail/em-utils.h"
+#include "mail/mail-session.h"
+
+#define E_MAIL_JUNK_HOOK_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_MAIL_JUNK_HOOK, EMailJunkHookPrivate))
+
+struct _EMailJunkHookPrivate {
+	EMJunkInterface interface;
+};
+
+struct ErrorData {
+	const gchar *error_message;
+	GError *error;
+};
+
+static gpointer parent_class;
+static GType mail_junk_hook_type;
+
+static gboolean
+mail_junk_hook_idle_cb (struct ErrorData *data)
+{
+	GtkWidget *widget;
+
+	widget = e_alert_dialog_new_for_args (e_shell_get_active_window (NULL),
+		data->error_message, data->error->message, NULL);
+	em_utils_show_error_silent (widget);
+
+	g_error_free (data->error);
+	g_slice_free (struct ErrorData, data);
+
+	return FALSE;
+}
+
+static void
+mail_junk_hook_error (const gchar *error_message,
+                      GError *error)
+{
+	struct ErrorData *data;
+
+	g_return_if_fail (error != NULL);
+
+	data = g_slice_new (struct ErrorData);
+	data->error_message = error_message;
+	data->error = error;
+
+	g_idle_add ((GSourceFunc) mail_junk_hook_idle_cb, data);
+}
+
+static const gchar *
+mail_junk_hook_get_name (CamelJunkPlugin *junk_plugin)
+{
+	EMJunkInterface *interface;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	if (!interface->hook->plugin->enabled)
+		return _("None");
+
+	return interface->hook->plugin->name;
+}
+
+static void
+mail_junk_hook_plugin_init (CamelJunkPlugin *junk_plugin)
+{
+	EMJunkInterface *interface;
+	EPluginClass *class;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	class = E_PLUGIN_GET_CLASS (interface->hook->plugin);
+	g_return_if_fail (class->enable != NULL);
+
+	class->enable (interface->hook->plugin, 1);
+}
+
+static gboolean
+mail_junk_hook_check_junk (CamelJunkPlugin *junk_plugin,
+                           CamelMimeMessage *mime_message)
+{
+	EMJunkTarget target = { mime_message, NULL };
+	EMJunkInterface *interface;
+	gpointer result;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	if (!interface->hook->plugin->enabled)
+		return FALSE;
+
+	result = e_plugin_invoke (
+		interface->hook->plugin,
+		interface->check_junk, &target);
+
+	if (target.error != NULL)
+		mail_junk_hook_error ("mail:junk-check-error", target.error);
+
+	return (result != NULL);
+}
+
+static void
+mail_junk_hook_report_junk (CamelJunkPlugin *junk_plugin,
+                            CamelMimeMessage *mime_message)
+{
+	EMJunkTarget target = { mime_message, NULL };
+	EMJunkInterface *interface;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	if (!interface->hook->plugin->enabled)
+		return;
+
+	e_plugin_invoke (
+		interface->hook->plugin,
+		interface->report_junk, &target);
+
+	if (target.error != NULL)
+		mail_junk_hook_error ("mail:junk-report-error", target.error);
+}
+
+static void
+mail_junk_hook_report_notjunk (CamelJunkPlugin *junk_plugin,
+                               CamelMimeMessage *mime_message)
+{
+	EMJunkTarget target = { mime_message, NULL };
+	EMJunkInterface *interface;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	if (!interface->hook->plugin->enabled)
+		return;
+
+	e_plugin_invoke (
+		interface->hook->plugin,
+		interface->report_notjunk, &target);
+
+	if (target.error != NULL)
+		mail_junk_hook_error (
+			"mail:junk-not-report-error", target.error);
+}
+
+static void
+mail_junk_hook_commit_reports (CamelJunkPlugin *junk_plugin)
+{
+	EMJunkInterface *interface;
+
+	interface = (EMJunkInterface *) junk_plugin;
+
+	if (!interface->hook->plugin->enabled)
+		return;
+
+	e_plugin_invoke (
+		interface->hook->plugin,
+		interface->commit_reports, NULL);
+}
+
+static void
+mail_junk_hook_finalize (GObject *object)
+{
+	EMailJunkHookPrivate *priv;
+
+	priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (object);
+
+	g_free (priv->interface.check_junk);
+	g_free (priv->interface.report_junk);
+	g_free (priv->interface.report_notjunk);
+	g_free (priv->interface.commit_reports);
+	g_free (priv->interface.validate_binary);
+	g_free (priv->interface.plugin_name);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gint
+mail_junk_hook_construct (EPluginHook *hook,
+                          EPlugin *plugin,
+                          xmlNodePtr node)
+{
+	EMailJunkHookPrivate *priv;
+	gchar *property;
+
+	priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (hook);
+
+	/* Chain up to parent's construct() method. */
+	if (E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node) == -1)
+		return -1;
+
+	if (!plugin->enabled)
+		return -1;
+
+	node = xmlFirstElementChild (node);
+
+	if (node == NULL)
+		return -1;
+
+	if (g_strcmp0 ((gchar *) node->name, "interface") != 0)
+		return -1;
+
+	property = e_plugin_xml_prop (node, "check_junk");
+	priv->interface.check_junk = property;
+
+	property = e_plugin_xml_prop (node, "report_junk");
+	priv->interface.report_junk = property;
+
+	property = e_plugin_xml_prop (node, "report_non_junk");
+	priv->interface.report_notjunk = property;
+
+	property = e_plugin_xml_prop (node, "commit_reports");
+	priv->interface.commit_reports = property;
+
+	property = e_plugin_xml_prop (node, "validate_binary");
+	priv->interface.validate_binary = property;
+
+	property = e_plugin_xml_prop (node, "name");
+	priv->interface.plugin_name = property;
+
+	if (priv->interface.check_junk == NULL)
+		return -1;
+
+	if (priv->interface.report_junk == NULL)
+		return -1;
+
+	if (priv->interface.report_notjunk == NULL)
+		return -1;
+
+	if (priv->interface.commit_reports == NULL)
+		return -1;
+
+	mail_session_add_junk_plugin (
+		priv->interface.plugin_name, &priv->interface.camel);
+
+	return 0;
+}
+
+static void
+mail_junk_hook_class_init (EMailJunkHookClass *class)
+{
+	GObjectClass *object_class;
+	EPluginHookClass *plugin_hook_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EMailJunkHookPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = mail_junk_hook_finalize;
+
+	plugin_hook_class = E_PLUGIN_HOOK_CLASS (class);
+	plugin_hook_class->construct = mail_junk_hook_construct;
+	plugin_hook_class->id = "org.gnome.evolution.mail.junk:1.0";
+}
+
+static void
+mail_junk_hook_init (EMailJunkHook *mail_junk_hook)
+{
+	EMJunkInterface *interface;
+
+	mail_junk_hook->priv = E_MAIL_JUNK_HOOK_GET_PRIVATE (mail_junk_hook);
+
+	interface = &mail_junk_hook->priv->interface;
+	interface->camel.get_name = mail_junk_hook_get_name;
+	interface->camel.api_version = 1;
+	interface->camel.check_junk = mail_junk_hook_check_junk;
+	interface->camel.report_junk = mail_junk_hook_report_junk;
+	interface->camel.report_notjunk = mail_junk_hook_report_notjunk;
+	interface->camel.commit_reports = mail_junk_hook_commit_reports;
+	interface->camel.init = mail_junk_hook_plugin_init;
+	interface->hook = E_PLUGIN_HOOK (mail_junk_hook);
+}
+
+GType
+e_mail_junk_hook_get_type (void)
+{
+	return mail_junk_hook_type;
+}
+
+void
+e_mail_junk_hook_register_type (GTypeModule *type_module)
+{
+	const GTypeInfo type_info = {
+		sizeof (EMailJunkHookClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) mail_junk_hook_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (EMailJunkHook),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) mail_junk_hook_init,
+		NULL   /* value_table */
+	};
+
+	mail_junk_hook_type = g_type_module_register_type (
+		type_module, E_TYPE_PLUGIN_HOOK,
+		"EMailJunkHook", &type_info, 0);
+}
diff --git a/src/module/e-mail-junk-hook.h b/src/module/e-mail-junk-hook.h
new file mode 100644
index 0000000..f5882e6
--- /dev/null
+++ b/src/module/e-mail-junk-hook.h
@@ -0,0 +1,66 @@
+/*
+ * e-mail-junk-hook.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_JUNK_HOOK_H
+#define E_MAIL_JUNK_HOOK_H
+
+#include <e-util/e-plugin.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_JUNK_HOOK \
+	(e_mail_junk_hook_get_type ())
+#define E_MAIL_JUNK_HOOK(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_MAIL_JUNK_HOOK, EMailJunkHook))
+#define E_MAIL_JUNK_HOOK_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_MAIL_JUNK_HOOK, EMailJunkHookClass))
+#define E_IS_MAIL_JUNK_HOOK(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_MAIL_JUNK_HOOK))
+#define E_IS_MAIL_JUNK_HOOK_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_MAIL_JUNK_HOOK))
+#define E_MAIL_JUNK_HOOK_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_MAIL_JUNK_HOOK, EMailJunkHookClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailJunkHook EMailJunkHook;
+typedef struct _EMailJunkHookClass EMailJunkHookClass;
+typedef struct _EMailJunkHookPrivate EMailJunkHookPrivate;
+
+struct _EMailJunkHook {
+	EPluginHook parent;
+	EMailJunkHookPrivate *priv;
+};
+
+struct _EMailJunkHookClass {
+	EPluginHookClass parent_class;
+};
+
+GType		e_mail_junk_hook_get_type	(void);
+void		e_mail_junk_hook_register_type	(GTypeModule *type_module);
+
+G_END_DECLS
+
+#endif /* E_MAIL_JUNK_HOOK_H */
diff --git a/src/module/e-mail-shell-settings.c b/src/module/e-mail-shell-settings.c
new file mode 100644
index 0000000..1434951
--- /dev/null
+++ b/src/module/e-mail-shell-settings.c
@@ -0,0 +1,237 @@
+/*
+ * e-mail-shell-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-shell-settings.h"
+
+#include <gconf/gconf-client.h>
+#include <libedataserver/e-account-list.h>
+
+#include "e-util/e-signature-list.h"
+#include "mail/e-mail-label-list-store.h"
+#include "mail/mail-session.h"
+
+void
+e_mail_shell_settings_init (EShell *shell)
+{
+	EShellSettings *shell_settings;
+	gpointer object;
+
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	/*** Global Objects ***/
+
+	e_shell_settings_install_property (
+		g_param_spec_object (
+			"mail-label-list-store",
+			NULL,
+			NULL,
+			E_TYPE_MAIL_LABEL_LIST_STORE,
+			G_PARAM_READWRITE));
+
+	object = e_mail_label_list_store_new ();
+	e_shell_settings_set_object (
+		shell_settings, "mail-label-list-store", object);
+	g_object_unref (object);
+
+	e_shell_settings_install_property (
+		g_param_spec_pointer (
+			"mail-session",
+			NULL,
+			NULL,
+			G_PARAM_READWRITE));
+
+	camel_object_ref (session);
+	e_shell_settings_set_pointer (
+		shell_settings, "mail-session", session);
+
+	/*** Mail Preferences ***/
+
+	e_shell_settings_install_property_for_key (
+		"mail-address-compress",
+		"/apps/evolution/mail/display/address_compress");
+
+	e_shell_settings_install_property_for_key (
+		"mail-address-count",
+		"/apps/evolution/mail/display/address_count");
+
+	e_shell_settings_install_property_for_key (
+		"mail-charset",
+		"/apps/evolution/mail/display/charset");
+
+	e_shell_settings_install_property_for_key (
+		"mail-check-for-junk",
+		"/apps/evolution/mail/junk/check_incoming");
+
+	e_shell_settings_install_property_for_key (
+		"mail-citation-color",
+		"/apps/evolution/mail/display/citation_colour");
+
+	e_shell_settings_install_property_for_key (
+		"mail-confirm-expunge",
+		"/apps/evolution/mail/prompts/expunge");
+
+	e_shell_settings_install_property_for_key (
+		"mail-confirm-unwanted-html",
+		"/apps/evolution/mail/prompts/unwanted_html");
+
+	e_shell_settings_install_property_for_key (
+		"mail-empty-junk-on-exit",
+		"/apps/evolution/mail/junk/empty_on_exit");
+
+	e_shell_settings_install_property_for_key (
+		"mail-empty-trash-on-exit",
+		"/apps/evolution/mail/trash/empty_on_exit");
+
+	e_shell_settings_install_property_for_key (
+		"mail-enable-search-folders",
+		"/apps/evolution/mail/display/enable_vfolders");
+
+	e_shell_settings_install_property_for_key (
+		"mail-font-monospace",
+		"/apps/evolution/mail/display/fonts/monospace");
+
+	e_shell_settings_install_property_for_key (
+		"mail-font-variable",
+		"/apps/evolution/mail/display/fonts/variable");
+
+	e_shell_settings_install_property_for_key (
+		"mail-force-message-limit",
+		"/apps/evolution/mail/display/force_message_limit");
+
+	/* This value corresponds to MailConfigForwardStyle enum. */
+	e_shell_settings_install_property_for_key (
+		"mail-forward-style",
+		"/apps/evolution/mail/format/forward_style");
+
+	/* This value corresponds to MailConfigHTTPMode enum. */
+	e_shell_settings_install_property_for_key (
+		"mail-image-loading-policy",
+		"/apps/evolution/mail/display/load_http_images");
+
+	e_shell_settings_install_property_for_key (
+		"mail-magic-spacebar",
+		"/apps/evolution/mail/display/magic_spacebar");
+
+	e_shell_settings_install_property_for_key (
+		"mail-mark-citations",
+		"/apps/evolution/mail/display/mark_citations");
+
+	e_shell_settings_install_property_for_key (
+		"mail-mark-seen",
+		"/apps/evolution/mail/display/mark_seen");
+
+	e_shell_settings_install_property_for_key (
+		"mail-mark-seen-timeout",
+		"/apps/evolution/mail/display/mark_seen_timeout");
+
+	e_shell_settings_install_property_for_key (
+		"mail-message-text-part-limit",
+		"/apps/evolution/mail/display/message_text_part_limit");
+
+	e_shell_settings_install_property_for_key (
+		"mail-only-local-photos",
+		"/apps/evolution/mail/display/photo_local");
+
+	e_shell_settings_install_property_for_key (
+		"mail-show-real-date",
+		"/apps/evolution/mail/display/show_real_date");
+
+	e_shell_settings_install_property_for_key (
+		"mail-prompt-delete-in-vfolder",
+		"/apps/evolution/mail/prompts/delete_in_vfolder");
+
+	/* This value corresponds to MailConfigReplyStyle enum,
+	 * but the ordering of the combo box items in preferences
+	 * has changed.  We use transformation functions there. */
+	e_shell_settings_install_property_for_key (
+		"mail-reply-style",
+		"/apps/evolution/mail/format/reply_style");
+
+	e_shell_settings_install_property_for_key (
+		"mail-show-animated-images",
+		"/apps/evolution/mail/display/animated_images");
+
+	e_shell_settings_install_property_for_key (
+		"mail-show-sender-photo",
+		"/apps/evolution/mail/display/sender_photo");
+
+	e_shell_settings_install_property_for_key (
+		"mail-side-bar-search",
+		"/apps/evolution/mail/display/side_bar_search");
+
+	e_shell_settings_install_property_for_key (
+		"mail-use-custom-fonts",
+		"/apps/evolution/mail/display/fonts/use_custom");
+
+	/*** Composer Preferences ***/
+
+	e_shell_settings_install_property_for_key (
+		"composer-charset",
+		"/apps/evolution/mail/composer/charset");
+
+	e_shell_settings_install_property_for_key (
+		"composer-format-html",
+		"/apps/evolution/mail/composer/send_html");
+
+	e_shell_settings_install_property_for_key (
+		"composer-inline-spelling",
+		"/apps/evolution/mail/composer/inline_spelling");
+
+	e_shell_settings_install_property_for_key (
+		"composer-magic-links",
+		"/apps/evolution/mail/composer/magic_links");
+
+	e_shell_settings_install_property_for_key (
+		"composer-magic-smileys",
+		"/apps/evolution/mail/composer/magic_smileys");
+
+	e_shell_settings_install_property_for_key (
+		"composer-outlook-filenames",
+		"/apps/evolution/mail/composer/outlook_filenames");
+
+	e_shell_settings_install_property_for_key (
+		"composer-prompt-only-bcc",
+		"/apps/evolution/mail/prompts/only_bcc");
+
+	e_shell_settings_install_property_for_key (
+		"composer-prompt-empty-subject",
+		"/apps/evolution/mail/prompts/empty_subject");
+
+	e_shell_settings_install_property_for_key (
+		"composer-reply-start-bottom",
+		"/apps/evolution/mail/composer/reply_start_bottom");
+
+	e_shell_settings_install_property_for_key (
+		"composer-request-receipt",
+		"/apps/evolution/mail/composer/request_receipt");
+
+	e_shell_settings_install_property_for_key (
+		"composer-spell-color",
+		"/apps/evolution/mail/composer/spell_color");
+
+	e_shell_settings_install_property_for_key (
+		"composer-top-signature",
+		"/apps/evolution/mail/composer/top_signature");
+
+	e_shell_settings_install_property_for_key (
+		"composer-no-signature-delim",
+		"/apps/evolution/mail/composer/no_signature_delim");
+}
diff --git a/src/module/e-mail-shell-settings.h b/src/module/e-mail-shell-settings.h
new file mode 100644
index 0000000..4267fd8
--- /dev/null
+++ b/src/module/e-mail-shell-settings.h
@@ -0,0 +1,33 @@
+/*
+ * e-mail-shell-settings.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_MAIL_SHELL_SETTINGS_H
+#define E_MAIL_SHELL_SETTINGS_H
+
+#include <shell/e-shell.h>
+
+G_BEGIN_DECLS
+
+void		e_mail_shell_settings_init	(EShell *shell);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_SETTINGS_H */
diff --git a/src/module/evolution-module-anjal.c b/src/module/evolution-module-anjal.c
new file mode 100644
index 0000000..867a9ea
--- /dev/null
+++ b/src/module/evolution-module-anjal.c
@@ -0,0 +1,71 @@
+/*
+ * evolution-module-mail.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-mail-attachment-handler.h"
+
+#include "e-mail-config-hook.h"
+#include "e-mail-event-hook.h"
+#include "e-mail-junk-hook.h"
+
+#include "anjal-shell-backend.h"
+#include "anjal-shell-content.h"
+#include "anjal-shell-sidebar.h"
+#include "anjal-shell-view.h"
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+const gchar * g_module_check_init (GModule *module);
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+	/* Register dynamically loaded types. */
+
+	e_mail_attachment_handler_register_type (type_module);
+
+	e_mail_config_hook_register_type (type_module);
+	e_mail_event_hook_register_type (type_module);
+	e_mail_junk_hook_register_type (type_module);
+
+	anjal_shell_backend_register_type (type_module);
+	anjal_shell_content_register_type (type_module);
+	anjal_shell_sidebar_register_type (type_module);
+	anjal_shell_view_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
+G_MODULE_EXPORT const gchar *
+g_module_check_init (GModule *module)
+{
+	/* FIXME Until mail is split into a module library and a
+	 *       reusable shared library, prevent the module from
+	 *       being unloaded.  Unloading the module resets all
+	 *       static variables, which screws up foo_get_type()
+	 *       functions among other things. */
+	g_module_make_resident (module);
+
+	return NULL;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]