[anjal] Anjal for master branch of Evolution.



commit 0d718ab4899647e1562c11de602e944b5df406aa
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Mon Dec 21 09:38:48 2009 +0530

    Anjal for master branch of Evolution.

 configure.ac                          |    9 +-
 src/Makefile.am                       |    6 +-
 src/anjal-mail-view.c                 |  139 ++++
 src/anjal-mail-view.h                 |   76 +++
 src/mail-view.c                       |    2 +-
 src/mail-view.h                       |    4 +-
 src/module/Makefile.am                |   25 +
 src/module/anjal-shell-backend.c      |  446 +++++++++++++
 src/module/anjal-shell-backend.h      |   75 +++
 src/module/anjal-shell-content.c      |  296 +++++++++
 src/module/anjal-shell-content.h      |   92 +++
 src/module/anjal-shell-sidebar.c      |  274 ++++++++
 src/module/anjal-shell-sidebar.h      |   72 ++
 src/module/anjal-shell-view-actions.c | 1163 +++++++++++++++++++++++++++++++++
 src/module/anjal-shell-view-actions.h |  257 ++++++++
 src/module/anjal-shell-view-private.c |  292 +++++++++
 src/module/anjal-shell-view-private.h |  184 ++++++
 src/module/anjal-shell-view.c         |  608 +++++++++++++++++
 src/module/anjal-shell-view.h         |   77 +++
 19 files changed, 4092 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a60e729..2131064 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,9 +23,15 @@ AC_SUBST_FILE(EVO_MARSHAL_RULE)
 privdatadir='${datadir}'/anjal
 AC_SUBST(privdatadir)
 
+privlibdir = '${libdir}'/anjal
+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)
 evolutionmoduledir=`pkg-config --variable=moduledir evolution-shell`
@@ -53,7 +59,7 @@ AM_PROG_LIBTOOL
 
 
 
-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-shell >= 2.27.5 evolution-plugin libxml-2.0 sqlite3 libgtkhtml-3.14 gtkhtml-editor dbus-1])
+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`"
 
 if test "x$EVO_VERSION" = "x2.26"; then
@@ -142,5 +148,6 @@ AC_OUTPUT([
 Makefile
 art/Makefile
 src/Makefile
+src/module/Makefile
 po/Makefile.in
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 7920ce5..1d657db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,8 @@
 #gladedir = $(datadir)/anjal/glade
 #glade_DATA = anjal.glade
 
+SUBDIRS = module
+
 AM_CPPFLAGS = \
 	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
 	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
@@ -23,6 +25,8 @@ bin_PROGRAMS = anjal
 
 anjal_SOURCES = \
 	main.c \
+	anjal-mail-view.c \
+	anjal-mail-view.h \
 	mail-shell.c \
 	mail-shell.h \
 	mail-decoration.c \
@@ -99,7 +103,7 @@ anjal_LDADD = $(ANJAL_LIBS) \
 	$(ANERLEY_LIBS) \
 	-lemiscwidgets \
 	-lfilter \
-	-L"$(evolutionprivdir)/anjal" -levolution-module-anjal
+	-L"$(evolutionprivdir)/anjal"
 
 #-lefilterbar 
 	
diff --git a/src/anjal-mail-view.c b/src/anjal-mail-view.c
new file mode 100644
index 0000000..5178b56
--- /dev/null
+++ b/src/anjal-mail-view.c
@@ -0,0 +1,139 @@
+/*
+ * 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/>  
+ *
+ *
+ * Authors:
+ *		Srinivasa Ragavan <sragavan novell com>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "anjal-mail-view.h"
+#include <glib/gi18n.h>
+#include "mail/em-utils.h"
+#include "mail/mail-send-recv.h"
+#include "mail/mail-ops.h"
+#include "mail/em-folder-tree.h"
+
+
+struct  _AnjalMailViewPrivate {
+
+	gboolean started;
+};
+
+
+G_DEFINE_TYPE (AnjalMailView, anjal_mail_view, GTK_TYPE_NOTEBOOK)
+
+static void
+anjal_mail_view_init (AnjalMailView  *shell)
+{
+	shell->priv = g_new0(AnjalMailViewPrivate, 1);
+	shell->priv->started = TRUE;
+}
+
+static void
+anjal_mail_view_finalize (GObject *object)
+{
+	AnjalMailView *shell = (AnjalMailView *)object;
+	AnjalMailViewPrivate *priv = shell->priv;
+	
+	g_free (priv);
+	
+	G_OBJECT_CLASS (anjal_mail_view_parent_class)->finalize (object);
+}
+
+static 	void 
+view_set_folder_uri (AnjalMailView *mail_view, const gchar *uri)
+{
+}
+static void 
+view_set_folder_tree_widget (AnjalMailView *mail_view, GtkWidget *tree)
+{
+}
+static void 
+view_set_folder_tree (AnjalMailView *mail_view, EMFolderTree *tree)
+{
+}
+
+static void 
+view_set_search (AnjalMailView *mail_view, const char *search)
+{
+}
+
+static void 
+view_init_search (AnjalMailView *mail_view, GtkWidget *search)
+{
+}
+
+static void
+anjal_mail_view_class_init (AnjalMailViewClass *klass)
+{
+	GObjectClass * object_class = G_OBJECT_CLASS (klass);
+
+	anjal_mail_view_parent_class = g_type_class_peek_parent (klass);
+	object_class->finalize = anjal_mail_view_finalize;
+	klass->set_folder_uri = view_set_folder_uri;
+	klass->set_folder_tree_widget = view_set_folder_tree_widget;
+	klass->set_folder_tree = view_set_folder_tree;
+	klass->set_search = view_set_search;
+	klass->init_search = view_init_search;
+};
+
+
+AnjalMailView *
+anjal_mail_view_new ()
+{
+	AnjalMailView *shell = g_object_new (ANJAL_MAIL_VIEW_TYPE, NULL);
+	
+	return shell;
+}
+
+void  
+anjal_mail_view_set_folder_uri (AnjalMailView *mv, const char *uri)
+{
+	if (!mv || !uri)
+		return;
+
+	ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_uri (mv, uri);
+}
+
+void 
+anjal_mail_view_set_folder_tree_widget (AnjalMailView *mv, GtkWidget *tree)
+{
+	ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_tree_widget (mv, tree);
+}
+
+void 
+anjal_mail_view_set_folder_tree (AnjalMailView *mv, GtkWidget *tree)
+{
+	ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_tree (mv, (EMFolderTree *)tree);
+}
+
+void 
+anjal_mail_view_set_search (AnjalMailView *view, const char *search)
+{
+	ANJAL_MAIL_VIEW_GET_CLASS(view)->set_search (view, search);
+}
+
+void 
+anjal_mail_view_init_search (AnjalMailView *mv, GtkWidget *search)
+{
+	ANJAL_MAIL_VIEW_GET_CLASS(mv)->init_search (mv, search);
+}
+
diff --git a/src/anjal-mail-view.h b/src/anjal-mail-view.h
new file mode 100644
index 0000000..647d07b
--- /dev/null
+++ b/src/anjal-mail-view.h
@@ -0,0 +1,76 @@
+/*
+ * 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/>  
+ *
+ *
+ * Authors:
+ *		Srinivasa Ragavan <sragavan novell com>
+ *
+ * Copyright (C) 2009 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef _ANJAL_MAIL_VIEW_H_
+#define _ANJAL_MAIL_VIEW_H_
+
+#include <gtk/gtk.h>
+#include <mail/em-folder-tree.h>
+
+#define ANJAL_MAIL_VIEW_TYPE        (anjal_mail_view_get_type ())
+#define ANJAL_MAIL_VIEW(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJAL_MAIL_VIEW_TYPE, AnjalMailView))
+#define ANJAL_MAIL_VIEW_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), ANJAL_MAIL_VIEW_TYPE, AnjalMailViewClass))
+#define ANJAL_IS_MAIL_VIEW(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJAL_MAIL_VIEW_TYPE))
+#define ANJAL_IS_MAIL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJAL_MAIL_VIEW_TYPE))
+#define ANJAL_MAIL_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), ANJAL_MAIL_VIEW_TYPE, AnjalMailViewClass))
+
+typedef struct _AnjalMailViewPrivate AnjalMailViewPrivate;
+
+typedef struct _AnjalMailView {
+	GtkNotebook parent;
+
+	AnjalMailViewPrivate *priv;
+} AnjalMailView;
+
+typedef struct _AnjalMailViewClass {
+	GtkNotebookClass parent_class;
+	void (*set_folder_uri) (AnjalMailView *mail_view,
+                                const gchar *uri);
+	void (*set_folder_tree_widget) (AnjalMailView *mail_view,
+				GtkWidget *tree);
+	void (*set_folder_tree) (AnjalMailView *mail_view,
+				EMFolderTree *tree);
+	void (*set_search) (AnjalMailView *mail_view,
+				const char *search);
+	void (* init_search) (AnjalMailView *mail_view, GtkWidget *search);
+} AnjalMailViewClass;
+
+GType anjal_mail_view_get_type (void);
+AnjalMailView * anjal_mail_view_new (void);
+void  anjal_mail_view_set_folder_uri (AnjalMailView *mv, const char *uri);
+#if 0
+void anjal_mail_view_show_sort_popup (AnjalMailView *mv, GtkWidget *);
+void anjal_anjal_mail_view_show_list (AnjalMailView *mv);
+void anjal_mail_view_close_view (AnjalMailView *mv);
+void anjal_mail_view_set_check_email (AnjalMailView *mv, GtkWidget *button);
+void anjal_mail_view_set_sort_by  (AnjalMailView *mv, GtkWidget *button);
+void anjal_mail_view_check_mail(AnjalMailView *mv, gboolean deep);
+void anjal_mail_view_save (AnjalMailView *mv);
+void anjal_mail_view_set_slider (AnjalMailView *mv, GtkWidget *slider);
+void anjal_mail_view_switch_to_people (AnjalMailView* mv, MailViewChild *mpv);
+void anjal_mail_view_switch_to_settings (AnjalMailView* mv, MailViewChild *mpv);
+#endif
+void anjal_mail_view_set_folder_tree_widget (AnjalMailView *mv, GtkWidget *tree);
+void anjal_mail_view_set_folder_tree (AnjalMailView *mv, GtkWidget *tree);
+void anjal_mail_view_set_search (AnjalMailView *view, const char *search);
+void anjal_mail_view_init_search (AnjalMailView *mv, GtkWidget *search);
+#endif
diff --git a/src/mail-view.c b/src/mail-view.c
index d64d558..7f9e4c9 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -27,7 +27,6 @@
 #include "mail/em-utils.h"
 #include "mail/mail-send-recv.h"
 #include "mail/mail-ops.h"
-#include <mail/anjal-mail-view.h>
 #include "mail-view.h"
 #include "mail-folder-view.h"
 #include "mail-composer-view.h"
@@ -36,6 +35,7 @@
 #if HAVE_ANERLEY
 #  include "mail-people-view.h"
 #endif
+#include "anjal-mail-view.h"
 #include "mail-account-view.h"
 #include "mail-search.h"
 #include "mail/em-folder-tree.h"
diff --git a/src/mail-view.h b/src/mail-view.h
index 78df55d..339d690 100644
--- a/src/mail-view.h
+++ b/src/mail-view.h
@@ -23,10 +23,10 @@
 #ifndef _MAIL_VIEW_H_
 #define _MAIL_VIEW_H_
 
-#include <gtk/gtk.h>
-#include <mail/anjal-mail-view.h>
 #include <shell/e-shell-view.h>
 
+#include "anjal-mail-view.h"
+
 #define MAIL_VIEW_TYPE        (mail_view_get_type ())
 #define MAIL_VIEW(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_VIEW_TYPE, MailView))
 #define MAIL_VIEW_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), MAIL_VIEW_TYPE, MailViewClass))
diff --git a/src/module/Makefile.am b/src/module/Makefile.am
new file mode 100644
index 0000000..b8a4f80
--- /dev/null
+++ b/src/module/Makefile.am
@@ -0,0 +1,25 @@
+module_LTLIBRARIES = libeshell-module-anjal.la
+
+libeshell_module_anjal_la_CPPFLAGS =					\
+	-I$(top_srcdir)							\
+	$(ANJAL_CFLAGS)
+
+libeshell_module_anjal_la_SOURCES =					\
+	anjal-shell-backend.c						\
+	anjal-shell-backend.h						\
+	anjal-shell-content.c						\
+	anjal-shell-content.h						\
+	anjal-shell-sidebar.c						\
+	anjal-shell-sidebar.h						\
+	anjal-shell-view.c						\
+	anjal-shell-view.h						\
+	anjal-shell-view-actions.c					\
+	anjal-shell-view-actions.h					\
+	anjal-shell-view-private.c					\
+	anjal-shell-view-private.h
+
+libeshell_module_anjal_la_LIBADD =					\
+	$(ANJAL_LIBS)
+
+libeshell_module_anjal_la_LDFLAGS =					\
+	-avoid-version -module
diff --git a/src/module/anjal-shell-backend.c b/src/module/anjal-shell-backend.c
new file mode 100644
index 0000000..97ad5e4
--- /dev/null
+++ b/src/module/anjal-shell-backend.c
@@ -0,0 +1,446 @@
+/*
+ * anjal-shell-backend.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 "anjal-shell-backend.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-session.h>
+#include <camel/camel-url.h>
+
+#include "e-util/e-account-utils.h"
+#include "e-util/e-binding.h"
+#include "e-util/e-import.h"
+#include "e-util/e-util.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-window.h"
+#include "composer/e-msg-composer.h"
+
+/*#include "e-mail-shell-settings.h"*/
+#include "anjal-shell-sidebar.h"
+#include "anjal-shell-view.h"
+
+#include <mail/e-mail-browser.h>
+#include <mail/e-mail-local.h>
+#include <mail/e-mail-reader.h>
+#include <mail/e-mail-store.h>
+#include <mail/em-account-editor.h>
+/*#include <mail/em-account-prefs.h>*/
+/*#include <mail/em-composer-prefs.h>*/
+#include <mail/em-composer-utils.h>
+#include <mail/em-folder-utils.h>
+#include <mail/em-format-hook.h>
+#include <mail/em-format-html-display.h>
+/*#include <mail/em-mailer-prefs.h>*/
+/*#include <mail/em-network-prefs.h>*/
+#include <mail/em-utils.h>
+#include <mail/mail-config.h>
+#include <mail/mail-ops.h>
+#include <mail/mail-send-recv.h>
+#include <mail/mail-session.h>
+#include <mail/mail-vfolder.h>
+/*#include <mail/importers/mail-importer.h>*/
+
+#define ANJAL_SHELL_BACKEND_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendPrivate))
+
+#define BACKEND_NAME "anjal"
+
+struct _AnjalShellBackendPrivate {
+	gint mail_sync_in_progress;
+	guint mail_sync_source_id;
+};
+
+static gpointer parent_class;
+static GType anjal_shell_backend_type;
+
+static void
+anjal_shell_backend_init_importers (void)
+{
+	EImportClass *import_class;
+	EImportImporter *importer;
+
+	import_class = g_type_class_ref (e_import_get_type ());
+
+	importer = mbox_importer_peek ();
+	e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+	importer = elm_importer_peek ();
+	e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+	importer = pine_importer_peek ();
+	e_import_class_add_importer (import_class, importer, NULL, NULL);
+}
+
+static void
+anjal_shell_backend_sync_store_done_cb (CamelStore *store,
+                                        gpointer user_data)
+{
+	AnjalShellBackend *anjal_shell_backend = user_data;
+
+	anjal_shell_backend->priv->mail_sync_in_progress--;
+}
+
+static void
+anjal_shell_backend_sync_store_cb (CamelStore *store,
+                                   AnjalShellBackend *anjal_shell_backend)
+{
+	anjal_shell_backend->priv->mail_sync_in_progress++;
+
+	mail_sync_store (
+		store, FALSE,
+		anjal_shell_backend_sync_store_done_cb,
+		anjal_shell_backend);
+}
+
+static gboolean
+anjal_shell_backend_mail_sync (AnjalShellBackend *anjal_shell_backend)
+{
+	EShell *shell;
+	EShellBackend *shell_backend;
+
+	shell_backend = E_SHELL_BACKEND (anjal_shell_backend);
+	shell = e_shell_backend_get_shell (shell_backend);
+
+	/* Obviously we can only sync in online mode. */
+	if (!e_shell_get_online (shell))
+		goto exit;
+
+	/* If a sync is still in progress, skip this round. */
+	if (anjal_shell_backend->priv->mail_sync_in_progress)
+		goto exit;
+
+	e_mail_store_foreach (
+		(GHFunc) anjal_shell_backend_sync_store_cb,
+		anjal_shell_backend);
+
+exit:
+	return TRUE;
+}
+
+static void
+anjal_shell_backend_handle_email_uri_cb (gchar *folder_uri,
+                                         CamelFolder *folder,
+                                         gpointer user_data)
+{
+	EShellBackend *shell_backend = user_data;
+	CamelURL *url = user_data;
+	const gchar *forward;
+	const gchar *reply;
+	const gchar *uid;
+
+	if (folder == NULL) {
+		g_warning ("Could not open folder '%s'", folder_uri);
+		goto exit;
+	}
+
+	forward = camel_url_get_param (url, "forward");
+	reply = camel_url_get_param (url, "reply");
+	uid = camel_url_get_param (url, "uid");
+
+	if (reply != NULL) {
+		gint mode;
+
+		if (g_strcmp0 (reply, "all") == 0)
+			mode = REPLY_MODE_ALL;
+		else if (g_strcmp0 (reply, "list") == 0)
+			mode = REPLY_MODE_LIST;
+		else
+			mode = REPLY_MODE_SENDER;
+
+		em_utils_reply_to_message (folder, uid, NULL, mode, NULL);
+
+	} else if (forward != NULL) {
+		GPtrArray *uids;
+
+		uids = g_ptr_array_new ();
+		g_ptr_array_add (uids, g_strdup (uid));
+
+		if (g_strcmp0 (forward, "attached") == 0)
+			em_utils_forward_attached (folder, uids, folder_uri);
+		else if (g_strcmp0 (forward, "inline") == 0)
+			em_utils_forward_inline (folder, uids, folder_uri);
+		else if (g_strcmp0 (forward, "quoted") == 0)
+			em_utils_forward_quoted (folder, uids, folder_uri);
+		else
+			em_utils_forward_messages (folder, uids, folder_uri);
+
+	} else {
+		GtkWidget *browser;
+
+		/* FIXME Should pass in the shell module. */
+		browser = e_mail_browser_new (shell_backend);
+		e_mail_reader_set_folder (
+			E_MAIL_READER (browser), folder, folder_uri);
+		e_mail_reader_set_message (E_MAIL_READER (browser), uid);
+		gtk_widget_show (browser);
+	}
+
+exit:
+	camel_url_free (url);
+}
+
+static gboolean
+anjal_shell_backend_handle_uri_cb (EShell *shell,
+                                   const gchar *uri,
+                                   AnjalShellBackend *anjal_shell_backend)
+{
+	gboolean handled = TRUE;
+
+	if (g_str_has_prefix (uri, "mailto:";)) {
+		if (em_utils_check_user_can_send_mail ())
+			em_utils_compose_new_message_with_mailto (uri, NULL);
+
+	} else if (g_str_has_prefix (uri, "email:")) {
+		CamelURL *url;
+
+		url = camel_url_new (uri, NULL);
+		if (camel_url_get_param (url, "uid") != NULL) {
+			gchar *curi = em_uri_to_camel (uri);
+
+			mail_get_folder (
+				curi, 0,
+				anjal_shell_backend_handle_email_uri_cb,
+				anjal_shell_backend, mail_msg_unordered_push);
+			g_free (curi);
+
+		} else {
+			g_warning ("Email URI's must include a uid parameter");
+			camel_url_free (url);
+		}
+	} else
+		handled = FALSE;
+
+	return handled;
+}
+
+static void
+anjal_shell_backend_prepare_for_quit_cb (EShell *shell,
+                                         EActivity *activity,
+                                         EShellBackend *shell_backend)
+{
+	AnjalShellBackendPrivate *priv;
+
+	priv = ANJAL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+	/* Prevent a sync from starting while trying to shutdown. */
+	if (priv->mail_sync_source_id > 0) {
+		g_source_remove (priv->mail_sync_source_id);
+		priv->mail_sync_source_id = 0;
+	}
+}
+
+static void
+anjal_shell_backend_send_receive_cb (EShell *shell,
+                                     GtkWindow *parent,
+                                     EShellBackend *shell_backend)
+{
+	em_utils_clear_get_password_canceled_accounts_flag ();
+	mail_send_receive (parent);
+}
+
+static void
+anjal_shell_backend_window_created_cb (EShell *shell,
+                                       GtkWindow *window,
+                                       EShellBackend *shell_backend)
+{
+	EShellSettings *shell_settings;
+	static gboolean first_time = TRUE;
+
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	/* This applies to both the composer and signature editor. */
+	if (GTKHTML_IS_EDITOR (window)) {
+		GList *spell_languages;
+
+		e_binding_new (
+			shell_settings, "composer-inline-spelling",
+			window, "inline-spelling");
+
+		e_binding_new (
+			shell_settings, "composer-magic-links",
+			window, "magic-links");
+
+		e_binding_new (
+			shell_settings, "composer-magic-smileys",
+			window, "magic-smileys");
+
+		spell_languages = e_load_spell_languages ();
+		gtkhtml_editor_set_spell_languages (
+			GTKHTML_EDITOR (window), spell_languages);
+		g_list_free (spell_languages);
+	}
+
+	if (E_IS_MSG_COMPOSER (window)) {
+		/* Integrate the new composer into the mail module. */
+		em_configure_new_composer (E_MSG_COMPOSER (window));
+		return;
+	}
+
+	if (!E_IS_SHELL_WINDOW (window))
+		return;
+
+	if (first_time) {
+		g_signal_connect (
+			window, "map-event",
+			G_CALLBACK (e_msg_composer_check_autosave), NULL);
+		first_time = FALSE;
+	}
+}
+static void
+anjal_shell_backend_constructed (GObject *object)
+{
+	AnjalShellBackendPrivate *priv;
+	EShell *shell;
+	EShellBackend *shell_backend;
+	char *custom_dir;
+
+	priv = ANJAL_SHELL_BACKEND_GET_PRIVATE (object);
+
+	shell_backend = E_SHELL_BACKEND (object);
+	shell = e_shell_backend_get_shell (shell_backend);
+
+	/* This also initializes Camel, so it needs to happen early. */
+	mail_session_init (shell_backend);
+
+	/* Register format types for EMFormatHook. */
+	em_format_hook_register_type (em_format_get_type ());
+
+	/* Register plugin hook types. */
+	em_format_hook_get_type ();
+
+	anjal_shell_backend_init_importers ();
+
+	g_signal_connect (
+		shell, "handle-uri",
+		G_CALLBACK (anjal_shell_backend_handle_uri_cb),
+		shell_backend);
+
+	g_signal_connect (
+		shell, "prepare-for-quit",
+		G_CALLBACK (anjal_shell_backend_prepare_for_quit_cb),
+		shell_backend);
+
+	g_signal_connect (
+		shell, "send-receive",
+		G_CALLBACK (anjal_shell_backend_send_receive_cb),
+		shell_backend);
+
+	g_signal_connect (
+		shell, "window-created",
+		G_CALLBACK (anjal_shell_backend_window_created_cb),
+		shell_backend);
+
+	custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+	e_mail_store_init (custom_dir);
+	g_free (custom_dir);
+
+	e_mail_shell_settings_init (shell);
+}
+
+static void
+anjal_shell_backend_start (EShellBackend *shell_backend)
+{
+	AnjalShellBackendPrivate *priv;
+	EShell *shell;
+	EShellSettings *shell_settings;
+	gboolean enable_search_folders;
+
+	priv = ANJAL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+	shell = e_shell_backend_get_shell (shell_backend);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	/* XXX Do we really still need this flag? */
+	mail_session_set_interactive (TRUE);
+
+	enable_search_folders = e_shell_settings_get_boolean (
+		shell_settings, "mail-enable-search-folders");
+	if (enable_search_folders)
+		vfolder_load_storage ();
+
+	mail_autoreceive_init (shell_backend, session);
+
+	if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
+		priv->mail_sync_source_id = g_timeout_add_seconds (
+			mail_config_get_sync_timeout (),
+			(GSourceFunc) anjal_shell_backend_mail_sync,
+			shell_backend);
+}
+
+static void
+anjal_shell_backend_class_init (AnjalShellBackendClass *class)
+{
+	GObjectClass *object_class;
+	EShellBackendClass *shell_backend_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (AnjalShellBackendPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->constructed = anjal_shell_backend_constructed;
+
+	shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+	shell_backend_class->shell_view_type = ANJAL_TYPE_SHELL_VIEW;
+	shell_backend_class->name = BACKEND_NAME;
+	shell_backend_class->aliases = "";
+	shell_backend_class->schemes = "mailto:email";;
+	shell_backend_class->sort_order = 200;
+	shell_backend_class->preferences_page = "mail-accounts";
+	shell_backend_class->start = anjal_shell_backend_start;
+}
+
+static void
+anjal_shell_backend_init (AnjalShellBackend *mail_shell_backend)
+{
+	mail_shell_backend->priv =
+		ANJAL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend);
+}
+
+GType
+anjal_shell_backend_get_type (void)
+{
+	return anjal_shell_backend_type;
+}
+
+void
+anjal_shell_backend_register_type (GTypeModule *type_module)
+{
+	const GTypeInfo type_info = {
+		sizeof (AnjalShellBackendClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) anjal_shell_backend_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (AnjalShellBackend),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) anjal_shell_backend_init,
+		NULL   /* value_table */
+	};
+
+	anjal_shell_backend_type = g_type_module_register_type (
+		type_module, E_TYPE_MAIL_BACKEND,
+		"AnjalShellBackend", &type_info, 0);
+}
+
diff --git a/src/module/anjal-shell-backend.h b/src/module/anjal-shell-backend.h
new file mode 100644
index 0000000..47a7b32
--- /dev/null
+++ b/src/module/anjal-shell-backend.h
@@ -0,0 +1,75 @@
+/*
+ * anjal-shell-backend.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 ANJAL_SHELL_BACKEND_H
+#define ANJAL_SHELL_BACKEND_H
+
+#include <mail/e-mail-backend.h>
+
+#include <camel/camel-folder.h>
+#include <camel/camel-store.h>
+#include <e-util/e-signature-list.h>
+#include <libedataserver/e-account-list.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_BACKEND \
+	(anjal_shell_backend_get_type ())
+#define ANJAL_SHELL_BACKEND(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackend))
+#define ANJAL_SHELL_BACKEND_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendClass))
+#define E_IS_MAIL_SHELL_BACKEND(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ANJAL_TYPE_SHELL_BACKEND))
+#define ANJAL_IS_SHELL_BACKEND_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), ANJAL_TYPE_SHELL_BACKEND))
+#define ANJAL_SHELL_BACKEND_GET_CLASS(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellBackend AnjalShellBackend;
+typedef struct _AnjalShellBackendClass AnjalShellBackendClass;
+typedef struct _AnjalShellBackendPrivate AnjalShellBackendPrivate;
+
+struct _AnjalShellBackend {
+	EMailBackend parent;
+	AnjalShellBackendPrivate *priv;
+};
+
+struct _AnjalShellBackendClass {
+	EMailBackendClass parent_class;
+};
+
+GType		anjal_shell_backend_get_type	(void);
+void		anjal_shell_backend_register_type
+					(GTypeModule *type_module);
+
+/* XXX Find a better place for this function. */
+GSList *	e_mail_labels_get_filter_options(void);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_BACKEND_H */
diff --git a/src/module/anjal-shell-content.c b/src/module/anjal-shell-content.c
new file mode 100644
index 0000000..3463b2e
--- /dev/null
+++ b/src/module/anjal-shell-content.c
@@ -0,0 +1,296 @@
+/*
+ * anjal-shell-content.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 "anjal-shell-content.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-store.h>
+#include <libedataserver/e-data-server-util.h>
+
+#include <e-util/e-binding.h>
+#include <e-util/gconf-bridge.h>
+#include <misc/e-hinted-entry.h>
+#include <misc/e-paned.h>
+
+#include <mail/e-mail-reader.h>
+#include <mail/e-mail-search-bar.h>
+#include <mail/em-search-context.h>
+#include <mail/em-utils.h>
+#include <mail/mail-config.h>
+#include <mail/mail-ops.h>
+
+#include "anjal-shell-backend.h"
+#include "anjal-shell-view-actions.h"
+
+#define ANJAL_SHELL_CONTENT_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentPrivate))
+
+#define STATE_KEY_SCROLLBAR_POSITION	"ScrollbarPosition"
+#define STATE_KEY_SELECTED_MESSAGE	"SelectedMessage"
+
+struct _AnjalShellContentPrivate {
+	GtkWidget *view;
+	GtkWidget *view_box;
+	gboolean show_deleted;
+	GtkWidget *search_entry;
+};
+
+enum {
+	PROP_0,
+	PROP_SHOW_DELETED
+};
+
+static gpointer parent_class;
+static GType anjal_shell_content_type;
+
+
+static void
+anjal_shell_content_set_property (GObject *object,
+                                 guint property_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SHOW_DELETED:
+			anjal_shell_content_set_show_deleted (
+				ANJAL_SHELL_CONTENT (object),
+				g_value_get_boolean (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+anjal_shell_content_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SHOW_DELETED:
+			g_value_set_boolean (
+				value,
+				anjal_shell_content_get_show_deleted (
+				ANJAL_SHELL_CONTENT (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+anjal_shell_content_dispose (GObject *object)
+{
+	AnjalShellContentPrivate *priv;
+
+	priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+anjal_shell_content_constructed (GObject *object)
+{
+	AnjalShellContentPrivate *priv;
+	EShellContent *shell_content;
+	EShellBackend *shell_backend;
+	EShellView *shell_view;
+	EShellViewClass *shell_view_class;
+	GtkWidget *container;
+
+	priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (parent_class)->constructed (object);
+
+	shell_content = E_SHELL_CONTENT (object);
+	shell_view = e_shell_content_get_shell_view (shell_content);
+	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+	shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+	/* Build content widgets. */
+
+	container = GTK_WIDGET (object);
+
+	//widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
+	//gtk_container_add (GTK_CONTAINER (container), widget);
+
+	// Find a way to hook mail-view in here.
+	priv->view_box = gtk_vbox_new (FALSE, 0);
+	gtk_container_add (GTK_CONTAINER (container), priv->view_box);
+	gtk_widget_show (priv->view_box);
+
+}
+
+void
+anjal_shell_content_pack_view (EShellContent *shell_content, GtkWidget *view)
+{
+	AnjalShellContentPrivate *priv;
+	priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	gtk_box_pack_start ((GtkBox *)priv->view_box, view, TRUE, TRUE, 0);
+	priv->view = view;
+}
+
+static guint32
+anjal_shell_content_check_state (EShellContent *shell_content)
+{
+	return 0;
+}
+
+GtkWidget *
+anjal_shell_content_get_search_entry (EShellContent *shell_content)
+{	
+	AnjalShellContentPrivate *priv;
+
+	priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+	return priv->search_entry;
+}
+
+static void
+anjal_content_size_allocate (GtkWidget *widget,
+                             GtkAllocation *allocation)
+{
+	GtkAllocation child_allocation;
+	GtkWidget *child;
+
+	widget->allocation = *allocation;
+
+	child_allocation.x = allocation->x;
+	child_allocation.y = allocation->y;
+	child_allocation.width = allocation->width;
+	child_allocation.height = allocation->height;
+
+	child = gtk_bin_get_child (GTK_BIN (widget));
+	if (child != NULL)
+		gtk_widget_size_allocate (child, &child_allocation);
+
+}
+static void
+anjal_shell_content_class_init (AnjalShellContentClass *class)
+{
+	GObjectClass *object_class;
+	EShellContentClass *shell_content_class;
+	GtkWidgetClass *widget_class;
+	
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (AnjalShellContentPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = anjal_shell_content_set_property;
+	object_class->get_property = anjal_shell_content_get_property;
+	object_class->dispose = anjal_shell_content_dispose;
+	object_class->constructed = anjal_shell_content_constructed;
+
+	widget_class = GTK_WIDGET_CLASS (class);	
+	widget_class->size_allocate = anjal_content_size_allocate;
+
+	shell_content_class = E_SHELL_CONTENT_CLASS (class);
+	shell_content_class->check_state = anjal_shell_content_check_state;
+	shell_content_class->construct_searchbar = NULL;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SHOW_DELETED,
+		g_param_spec_boolean (
+			"show-deleted",
+			"Show Deleted",
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+}
+
+static void
+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. */
+}
+
+GType
+anjal_shell_content_get_type (void)
+{
+	return anjal_shell_content_type;
+}
+
+void
+anjal_shell_content_register_type (GTypeModule *type_module)
+{
+	static const GTypeInfo type_info = {
+		sizeof (AnjalShellContentClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) anjal_shell_content_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (AnjalShellContent),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) anjal_shell_content_init,
+		NULL   /* value_table */
+	};
+
+	anjal_shell_content_type = g_type_module_register_type (
+		type_module, E_TYPE_SHELL_CONTENT,
+		"AnjalShellContent", &type_info, 0);
+
+}
+
+GtkWidget *
+anjal_shell_content_new (EShellView *shell_view)
+{
+	g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+	return g_object_new (
+		ANJAL_TYPE_SHELL_CONTENT,
+		"shell-view", shell_view, NULL);
+}
+
+gboolean
+anjal_shell_content_get_show_deleted (AnjalShellContent *mail_shell_content)
+{
+	g_return_val_if_fail (
+		ANJAL_IS_SHELL_CONTENT (mail_shell_content), FALSE);
+
+	return mail_shell_content->priv->show_deleted;
+}
+
+void
+anjal_shell_content_set_show_deleted (AnjalShellContent *mail_shell_content,
+                                       gboolean show_deleted)
+{
+	g_return_if_fail (ANJAL_IS_SHELL_CONTENT (mail_shell_content));
+
+	mail_shell_content->priv->show_deleted = show_deleted;
+
+	g_object_notify (G_OBJECT (mail_shell_content), "show-deleted");
+}
+
+
diff --git a/src/module/anjal-shell-content.h b/src/module/anjal-shell-content.h
new file mode 100644
index 0000000..aed1673
--- /dev/null
+++ b/src/module/anjal-shell-content.h
@@ -0,0 +1,92 @@
+/*
+ * anjal-shell-content.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 ANJAL_SHELL_CONTENT_H
+#define ANJAL_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_CONTENT \
+	(anjal_shell_content_get_type ())
+#define ANJAL_SHELL_CONTENT(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContent))
+#define ANJAL_SHELL_CONTENT_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentClass))
+#define ANJAL_IS_SHELL_CONTENT(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ANJAL_TYPE_SHELL_CONTENT))
+#define ANJAL_IS_SHELL_CONTENT_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), ANJAL_TYPE_SHELL_CONTENT))
+#define ANJAL_SHELL_CONTENT_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellContent AnjalShellContent;
+typedef struct _AnjalShellContentClass AnjalShellContentClass;
+typedef struct _AnjalShellContentPrivate AnjalShellContentPrivate;
+
+struct _AnjalShellContent {
+	EShellContent parent;
+	AnjalShellContentPrivate *priv;
+};
+
+struct _AnjalShellContentClass {
+	EShellContentClass parent_class;
+};
+
+GType		anjal_shell_content_get_type	(void);
+void		anjal_shell_content_register_type
+					(GTypeModule *type_module);
+GtkWidget *	anjal_shell_content_new(EShellView *shell_view);
+gboolean	anjal_shell_content_get_preview_visible
+					(AnjalShellContent *mail_shell_content);
+void		anjal_shell_content_set_preview_visible
+					(AnjalShellContent *mail_shell_content,
+						 gboolean preview_visible);
+gboolean	anjal_shell_content_get_show_deleted
+					(AnjalShellContent *mail_shell_content);
+void		anjal_shell_content_set_show_deleted
+					(AnjalShellContent *mail_shell_content,
+					 gboolean show_deleted);
+GalViewInstance *
+		anjal_shell_content_get_view_instance
+					(AnjalShellContent *mail_shell_content);
+void		anjal_shell_content_set_search_strings
+					(AnjalShellContent *mail_shell_content,
+					 GSList *search_strings);
+void		anjal_shell_content_update_view_instance
+					(AnjalShellContent *mail_shell_content);
+GtkWidget *	anjal_shell_content_get_search_entry 
+					(EShellContent *shell_content);
+void		anjal_shell_content_pack_view 
+					(EShellContent *shell_content, 
+					 GtkWidget *view);
+					
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_CONTENT_H */
diff --git a/src/module/anjal-shell-sidebar.c b/src/module/anjal-shell-sidebar.c
new file mode 100644
index 0000000..d3ec5c1
--- /dev/null
+++ b/src/module/anjal-shell-sidebar.c
@@ -0,0 +1,274 @@
+/*
+ * anjal-shell-sidebar.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 "anjal-shell-sidebar.h"
+
+#include "e-util/e-binding.h"
+
+#include "mail/e-mail-sidebar.h"
+#include "mail/em-folder-utils.h"
+
+#define ANJAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), ANJAL_TYPE_SHELL_SIDEBAR, AnjalShellSidebarPrivate))
+
+struct _AnjalShellSidebarPrivate {
+	GtkWidget *folder_tree;
+};
+
+enum {
+	PROP_0,
+	PROP_FOLDER_TREE
+};
+
+static gpointer parent_class;
+static GType mail_shell_sidebar_type;
+
+static void
+mail_shell_sidebar_selection_changed_cb (EShellSidebar *shell_sidebar,
+                                         GtkTreeSelection *selection)
+{
+	EShellView *shell_view;
+	EShellViewClass *shell_view_class;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	const gchar *icon_name;
+	gchar *display_name = NULL;
+	gboolean is_folder = FALSE;
+	guint flags = 0;
+
+	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+
+	if (gtk_tree_selection_get_selected (selection, &model, &iter))
+		gtk_tree_model_get (
+			model, &iter,
+			COL_STRING_DISPLAY_NAME, &display_name,
+			COL_BOOL_IS_FOLDER, &is_folder,
+			COL_UINT_FLAGS, &flags, -1);
+
+	if (is_folder)
+		icon_name = em_folder_utils_get_icon_name (flags);
+	else {
+		icon_name = shell_view_class->icon_name;
+		display_name = g_strdup (shell_view_class->label);
+	}
+
+	e_shell_sidebar_set_icon_name (shell_sidebar, icon_name);
+	e_shell_sidebar_set_primary_text (shell_sidebar, display_name);
+
+	g_free (display_name);
+}
+
+static void
+mail_shell_sidebar_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_FOLDER_TREE:
+			g_value_set_object (
+				value, anjal_shell_sidebar_get_folder_tree (
+				ANJAL_SHELL_SIDEBAR (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_shell_sidebar_dispose (GObject *object)
+{
+	AnjalShellSidebarPrivate *priv;
+
+	priv = ANJAL_SHELL_SIDEBAR_GET_PRIVATE (object);
+
+	if (priv->folder_tree != NULL) {
+		g_object_unref (priv->folder_tree);
+		priv->folder_tree = NULL;
+	}
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+mail_shell_sidebar_constructed (GObject *object)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EShellSettings *shell_settings;
+	EShellSidebar *shell_sidebar;
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+	EShell *shell;
+	GtkTreeSelection *selection;
+	GtkTreeView *tree_view;
+	GtkWidget *container;
+	GtkWidget *widget;
+
+	/* Chain up to parent's constructed method. */
+	G_OBJECT_CLASS (parent_class)->constructed (object);
+
+	shell_sidebar = E_SHELL_SIDEBAR (object);
+	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	mail_shell_sidebar = ANJAL_SHELL_SIDEBAR (object);
+
+	/* Build sidebar widgets. */
+
+	container = GTK_WIDGET (object);
+
+	widget = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (
+		GTK_SCROLLED_WINDOW (widget),
+		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (
+		GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+	gtk_container_add (GTK_CONTAINER (container), widget);
+	gtk_widget_show (widget);
+
+	container = widget;
+
+	widget = e_mail_sidebar_new ();
+	gtk_container_add (GTK_CONTAINER (container), widget);
+	mail_shell_sidebar->priv->folder_tree = g_object_ref (widget);
+	gtk_widget_show (widget);
+
+	e_binding_new (
+		shell_view, "state-key-file",
+		widget, "key-file");
+
+	e_binding_new (
+		shell_settings, "mail-side-bar-search",
+		widget, "enable-search");
+
+	g_signal_connect_swapped (
+		widget, "key-file-changed",
+		G_CALLBACK (e_shell_view_set_state_dirty), shell_view);
+
+	tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree);
+	selection = gtk_tree_view_get_selection (tree_view);
+
+	g_signal_connect_swapped (
+		selection, "changed",
+		G_CALLBACK (mail_shell_sidebar_selection_changed_cb),
+		shell_sidebar);
+}
+
+static guint32
+mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
+{
+	AnjalShellSidebarPrivate *priv;
+	EMailSidebar *sidebar;
+
+	priv = ANJAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
+	sidebar = E_MAIL_SIDEBAR (priv->folder_tree);
+
+	return e_mail_sidebar_check_state (sidebar);
+}
+
+static void
+mail_shell_sidebar_class_init (AnjalShellSidebarClass *class)
+{
+	GObjectClass *object_class;
+	EShellSidebarClass *shell_sidebar_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (AnjalShellSidebarPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->get_property = mail_shell_sidebar_get_property;
+	object_class->dispose = mail_shell_sidebar_dispose;
+	object_class->constructed = mail_shell_sidebar_constructed;
+
+	shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
+	shell_sidebar_class->check_state = mail_shell_sidebar_check_state;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_FOLDER_TREE,
+		g_param_spec_object (
+			"folder-tree",
+			NULL,
+			NULL,
+			EM_TYPE_FOLDER_TREE,
+			G_PARAM_READABLE));
+}
+
+static void
+mail_shell_sidebar_init (AnjalShellSidebar *mail_shell_sidebar)
+{
+	mail_shell_sidebar->priv =
+		ANJAL_SHELL_SIDEBAR_GET_PRIVATE (mail_shell_sidebar);
+
+	/* Postpone widget construction until we have a shell view. */
+}
+
+GType
+anjal_shell_sidebar_get_type (void)
+{
+	return mail_shell_sidebar_type;
+}
+
+void
+anjal_shell_sidebar_register_type (GTypeModule *type_module)
+{
+	static const GTypeInfo type_info = {
+		sizeof (AnjalShellSidebarClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) mail_shell_sidebar_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (AnjalShellSidebar),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) mail_shell_sidebar_init,
+		NULL   /* value_table */
+	};
+
+	mail_shell_sidebar_type = g_type_module_register_type (
+		type_module, E_TYPE_SHELL_SIDEBAR,
+		"AnjalShellSidebar", &type_info, 0);
+}
+
+GtkWidget *
+anjal_shell_sidebar_new (EShellView *shell_view)
+{
+	g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+	return g_object_new (
+		ANJAL_TYPE_SHELL_SIDEBAR,
+		"shell-view", shell_view, NULL);
+}
+
+EMFolderTree *
+anjal_shell_sidebar_get_folder_tree (AnjalShellSidebar *mail_shell_sidebar)
+{
+	g_return_val_if_fail (
+		ANJAL_IS_SHELL_SIDEBAR (mail_shell_sidebar), NULL);
+
+	return EM_FOLDER_TREE (mail_shell_sidebar->priv->folder_tree);
+}
diff --git a/src/module/anjal-shell-sidebar.h b/src/module/anjal-shell-sidebar.h
new file mode 100644
index 0000000..3770abd
--- /dev/null
+++ b/src/module/anjal-shell-sidebar.h
@@ -0,0 +1,72 @@
+/*
+ * anjal-shell-sidebar.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 ANJAL_SHELL_SIDEBAR_H
+#define ANJAL_SHELL_SIDEBAR_H
+
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+#include <mail/em-folder-tree.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_SIDEBAR \
+	(anjal_shell_sidebar_get_type ())
+#define ANJAL_SHELL_SIDEBAR(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), ANJAL_TYPE_SHELL_SIDEBAR, AnjalShellSidebar))
+#define ANJAL_SHELL_SIDEBAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ANJAL_TYPE_SHELL_SIDEBAR, AnjalShellSidebarClass))
+#define ANJAL_IS_SHELL_SIDEBAR(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ANJAL_TYPE_SHELL_SIDEBAR))
+#define ANJAL_IS_SHELL_SIDEBAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ANJAL_TYPE_SHELL_SIDEBAR))
+#define ANJAL_SHELL_SIDEBAR_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), ANJAL_TYPE_SHELL_SIDEBAR, AnjalShellSidebarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellSidebar AnjalShellSidebar;
+typedef struct _AnjalShellSidebarClass AnjalShellSidebarClass;
+typedef struct _AnjalShellSidebarPrivate AnjalShellSidebarPrivate;
+
+struct _AnjalShellSidebar {
+	EShellSidebar parent;
+	AnjalShellSidebarPrivate *priv;
+};
+
+struct _AnjalShellSidebarClass {
+	EShellSidebarClass parent_class;
+};
+
+GType		anjal_shell_sidebar_get_type	(void);
+void		anjal_shell_sidebar_register_type
+					(GTypeModule *type_module);
+GtkWidget *	anjal_shell_sidebar_new(EShellView *shell_view);
+EMFolderTree *	anjal_shell_sidebar_get_folder_tree
+					(AnjalShellSidebar *mail_shell_sidebar);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_SIDEBAR_H */
diff --git a/src/module/anjal-shell-view-actions.c b/src/module/anjal-shell-view-actions.c
new file mode 100644
index 0000000..4363b24
--- /dev/null
+++ b/src/module/anjal-shell-view-actions.c
@@ -0,0 +1,1163 @@
+/*
+ * anjal-shell-view-actions.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 "anjal-shell-view-private.h"
+
+static void
+action_mail_account_disable_cb (GtkAction *action,
+                                AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	EAccountList *account_list;
+	EAccount *account;
+	gchar *folder_uri;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+	g_return_if_fail (folder_uri != NULL);
+
+	account_list = e_get_account_list ();
+	account = mail_config_get_account_by_source_url (folder_uri);
+	g_return_if_fail (account != NULL);
+
+	if (e_account_list_account_has_proxies (account_list, account))
+		e_account_list_remove_account_proxies (account_list, account);
+
+	account->enabled = !account->enabled;
+	e_account_list_change (account_list, account);
+	e_mail_store_remove_by_uri (folder_uri);
+
+	if (account->parent_uid != NULL)
+		e_account_list_remove (account_list, account);
+
+	e_account_list_save (account_list);
+
+	g_free (folder_uri);
+}
+
+
+static void
+action_mail_download_foreach_cb (CamelService *service)
+{
+	if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+		mail_store_prepare_offline (CAMEL_STORE (service));
+}
+
+static void
+action_mail_download_cb (GtkAction *action,
+                         AnjalShellView *mail_shell_view)
+{
+	e_mail_store_foreach ((GHFunc) action_mail_download_foreach_cb, NULL);
+}
+
+static void
+action_mail_empty_trash_cb (GtkAction *action,
+                            AnjalShellView *mail_shell_view)
+{
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	em_utils_empty_trash (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_flush_outbox_cb (GtkAction *action,
+                             AnjalShellView *mail_shell_view)
+{
+	mail_send ();
+}
+
+static void
+action_mail_folder_copy_cb (GtkAction *action,
+                            AnjalShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	AnjalShellSidebar *mail_shell_sidebar;
+	CamelFolderInfo *folder_info;
+	EMFolderTree *folder_tree;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+	g_return_if_fail (folder_info != NULL);
+
+	/* XXX Leaking folder_info? */
+	em_folder_utils_copy_folder (
+		GTK_WINDOW (shell_window), folder_info, FALSE);
+}
+
+static void
+action_mail_folder_delete_cb (GtkAction *action,
+                              AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	CamelFolder *folder;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder = em_folder_tree_get_selected_folder (folder_tree);
+	g_return_if_fail (folder != NULL);
+
+	em_folder_utils_delete_folder (folder);
+}
+
+static void
+action_mail_folder_expunge_cb (GtkAction *action,
+                               AnjalShellView *mail_shell_view)
+{
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+	EMFolderTree *folder_tree;
+	CamelFolder *folder;
+	AnjalShellSidebar * mail_shell_sidebar;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder = em_folder_tree_get_selected_folder (folder_tree);
+	g_return_if_fail (folder != NULL);
+
+	em_utils_expunge_folder (
+		GTK_WIDGET (shell_window), folder);
+}
+
+
+static void
+action_mail_folder_move_cb (GtkAction *action,
+                            AnjalShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	AnjalShellSidebar *mail_shell_sidebar;
+	CamelFolderInfo *folder_info;
+	EMFolderTree *folder_tree;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+	g_return_if_fail (folder_info != NULL);
+
+	/* XXX Leaking folder_info? */
+	em_folder_utils_copy_folder (
+		GTK_WINDOW (shell_window), folder_info, TRUE);
+}
+
+static void
+action_mail_folder_new_cb (GtkAction *action,
+                           AnjalShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	AnjalShellSidebar *mail_shell_sidebar;
+	CamelFolderInfo *folder_info;
+	EMFolderTree *folder_tree;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+	g_return_if_fail (folder_info != NULL);
+
+	em_folder_utils_create_folder (
+		folder_info, folder_tree, GTK_WINDOW (shell_window));
+	camel_folder_info_free (folder_info);
+}
+
+static void
+action_mail_folder_properties_cb (GtkAction *action,
+                                  AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	EShellView *shell_view;
+	GtkTreeSelection *selection;
+	GtkTreeView *tree_view;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gchar *uri;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	tree_view = GTK_TREE_VIEW (folder_tree);
+	selection = gtk_tree_view_get_selection (tree_view);
+	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+		return;
+
+	gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1);
+	em_folder_properties_show (shell_view, NULL, uri);
+	g_free (uri);
+}
+
+static void
+action_mail_folder_refresh_cb (GtkAction *action,
+                               AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	CamelFolder *folder;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	folder = em_folder_tree_get_selected_folder (folder_tree);
+	g_return_if_fail (folder != NULL);
+
+	mail_refresh_folder (folder, NULL, NULL);
+}
+
+static void
+action_mail_folder_rename_cb (GtkAction *action,
+                              AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	em_folder_tree_edit_selected (folder_tree);
+}
+
+
+static void
+action_mail_folder_unsubscribe_cb (GtkAction *action,
+                                   AnjalShellView *mail_shell_view)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	gchar *folder_uri;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+	em_folder_utils_unsubscribe_folder (folder_uri);
+	g_free (folder_uri);
+}
+
+
+static void
+action_mail_search_cb (GtkRadioAction *action,
+                       GtkRadioAction *current,
+                       AnjalShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+	EShellContent *shell_content;
+	const gchar *search_hint;
+
+	/* XXX Figure out a way to handle this in EShellContent
+	 *     instead of every shell view having to handle it.
+	 *     The problem is EShellContent does not know what
+	 *     the search option actions are for this view.  It
+	 *     would have to dig up the popup menu and retrieve
+	 *     the action for each menu item.  Seems messy. */
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+
+	search_hint = gtk_action_get_label (GTK_ACTION (current));
+	e_shell_content_set_search_hint (shell_content, search_hint);
+}
+
+static void
+action_mail_stop_cb (GtkAction *action,
+                     AnjalShellView *mail_shell_view)
+{
+	mail_cancel_all ();
+}
+
+
+static void
+action_mail_tools_filters_cb (GtkAction *action,
+                              AnjalShellView *mail_shell_view)
+{
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	em_utils_edit_filters (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_tools_search_folders_cb (GtkAction *action,
+                                     AnjalShellView *mail_shell_view)
+{
+	vfolder_edit (E_SHELL_VIEW (mail_shell_view));
+}
+
+static void
+action_mail_tools_subscriptions_cb (GtkAction *action,
+                                    AnjalShellView *mail_shell_view)
+{
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+	GtkWidget *dialog;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	dialog = em_subscribe_editor_new ();
+	gtk_window_set_transient_for (
+		GTK_WINDOW (dialog), GTK_WINDOW (shell_window));
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	/* XXX Dialog destroys itself. */
+}
+
+#if 0
+static void
+action_search_filter_cb (GtkRadioAction *action,
+                         GtkRadioAction *current,
+                         EShellView *shell_view)
+{
+	EShellContent *shell_content;
+	EShellWindow *shell_window;
+	GKeyFile *key_file;
+	const gchar *folder_uri = NULL;
+
+	shell_content = e_shell_view_get_shell_content (shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	key_file = e_shell_view_get_state_key_file (shell_view);
+
+	folder_uri = NULL; /* ANJAL: Get from folder tree */
+
+	if (folder_uri != NULL) {
+		const gchar *key;
+		const gchar *string;
+		gchar *group_name;
+
+		key = STATE_KEY_SEARCH_FILTER;
+		string = gtk_action_get_name (GTK_ACTION (current));
+		group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+		g_key_file_set_string (key_file, group_name, key, string);
+		e_shell_view_set_state_dirty (shell_view);
+
+		g_free (group_name);
+	}
+
+	e_shell_view_execute_search (shell_view);
+}
+#endif
+
+#if 0
+static void
+action_search_scope_cb (GtkRadioAction *action,
+                        GtkRadioAction *current,
+                        EShellView *shell_view)
+{
+	EShellContent *shell_content;
+	EShellWindow *shell_window;
+	GKeyFile *key_file;
+	const gchar *folder_uri;
+
+	shell_content = e_shell_view_get_shell_content (shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	key_file = e_shell_view_get_state_key_file (shell_view);
+
+	folder_uri = NULL; /* ANJAL: Get from folder tree */
+
+	if (folder_uri != NULL) {
+		const gchar *key;
+		const gchar *string;
+		gchar *group_name;
+
+		key = STATE_KEY_SEARCH_SCOPE;
+		string = gtk_action_get_name (GTK_ACTION (current));
+		group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+		g_key_file_set_string (key_file, group_name, key, string);
+		e_shell_view_set_state_dirty (shell_view);
+
+		g_free (group_name);
+	}
+
+	e_shell_view_execute_search (shell_view);
+}
+
+#endif
+static GtkActionEntry mail_entries[] = {
+
+	{ "mail-account-disable",
+	  NULL,
+	  N_("_Disable Account"),
+	  NULL,
+	  N_("Disable this account"),
+	  G_CALLBACK (action_mail_account_disable_cb) },
+
+	{ "mail-create-search-folder",
+	  NULL,
+	  N_("C_reate Search Folder From Search..."),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  NULL },
+
+	{ "mail-download",
+	  NULL,
+	  N_("_Download Messages for Offline Usage"),
+	  NULL,
+	  N_("Download messages of accounts and folders marked for offline"),
+	  G_CALLBACK (action_mail_download_cb) },
+
+	{ "mail-empty-trashes", /* this is File->Empty Trash action */
+	  NULL,
+	  N_("Empty _Trash"),
+	  NULL,
+	  N_("Permanently remove all the deleted messages from all folders"),
+	  G_CALLBACK (action_mail_empty_trash_cb) },
+
+	{ "mail-empty-trash", /* this is a popup action over the trash folder */
+	  NULL,
+	  N_("_Empty Trash"),
+	  NULL,
+	  N_("Permanently remove all the deleted messages from all folders"),
+	  G_CALLBACK (action_mail_empty_trash_cb) },
+
+	{ "mail-flush-outbox",
+	  "mail-send",
+	  N_("Fl_ush Outbox"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (action_mail_flush_outbox_cb) },
+
+	{ "mail-folder-copy",
+	  "folder-copy",
+	  N_("_Copy Folder To..."),
+	  NULL,
+	  N_("Copy the selected folder into another folder"),
+	  G_CALLBACK (action_mail_folder_copy_cb) },
+
+	{ "mail-folder-delete",
+	  GTK_STOCK_DELETE,
+	  NULL,
+	  NULL,
+	  N_("Permanently remove this folder"),
+	  G_CALLBACK (action_mail_folder_delete_cb) },
+
+	{ "mail-folder-expunge",
+	  NULL,
+	  N_("E_xpunge"),
+	  "<Control>e",
+	  N_("Permanently remove all deleted messages from this folder"),
+	  G_CALLBACK (action_mail_folder_expunge_cb) },
+
+	{ "mail-folder-mark-all-as-read",
+	  "mail-read",
+	  N_("Mar_k All Messages as Read"),
+	  NULL,
+	  N_("Mark all messages in the folder as read"),
+	  NULL },
+
+	{ "mail-folder-move",
+	  "folder-move",
+	  N_("_Move Folder To..."),
+	  NULL,
+	  N_("Move the selected folder into another folder"),
+	  G_CALLBACK (action_mail_folder_move_cb) },
+
+	{ "mail-folder-new",
+	  "folder-new",
+	  N_("_New..."),
+	  NULL,
+	  N_("Create a new folder for storing mail"),
+	  G_CALLBACK (action_mail_folder_new_cb) },
+
+	{ "mail-folder-properties",
+	  GTK_STOCK_PROPERTIES,
+	  NULL,
+	  NULL,
+	  N_("Change the properties of this folder"),
+	  G_CALLBACK (action_mail_folder_properties_cb) },
+
+	{ "mail-folder-refresh",
+	  GTK_STOCK_REFRESH,
+	  NULL,
+	  "F5",
+	  N_("Refresh the folder"),
+	  G_CALLBACK (action_mail_folder_refresh_cb) },
+
+	{ "mail-folder-rename",
+	  NULL,
+	  N_("_Rename..."),
+	  "F2",
+	  N_("Change the name of this folder"),
+	  G_CALLBACK (action_mail_folder_rename_cb) },
+
+	{ "mail-folder-select-all",
+	  NULL,
+	  N_("Select _All Messages"),
+	  "<Control>a",
+	  N_("Select all visible messages"),
+	  NULL },
+
+	{ "mail-folder-select-thread",
+	  NULL,
+	  N_("Select Message _Thread"),
+	  "<Control>h",
+	  N_("Select all messages in the same thread as the selected message"),
+	  NULL },
+
+	{ "mail-folder-select-subthread",
+	  NULL,
+	  N_("Select Message S_ubthread"),
+	  "<Shift><Control>h",
+	  N_("Select all replies to the currently selected message"),
+	  NULL },
+
+	{ "mail-folder-unsubscribe",
+	  NULL,
+	  N_("_Unsubscribe"),
+	  NULL,
+	  N_("Unsubscribe from the selected folder"),
+	  G_CALLBACK (action_mail_folder_unsubscribe_cb) },
+
+	{ "mail-label-new",
+	  NULL,
+	  N_("_New Label"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  NULL },
+
+	{ "mail-label-none",
+	  NULL,
+	  N_("N_one"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  NULL },
+
+	{ "mail-hide-read",
+	  NULL,
+	  N_("Hide _Read Messages"),
+	  NULL,
+	  N_("Temporarily hide all messages that have already been read"),
+	  NULL },
+
+	{ "mail-hide-selected",
+	  NULL,
+	  N_("Hide S_elected Messages"),
+	  NULL,
+	  N_("Temporarily hide the selected messages"),
+	  NULL },
+
+	{ "mail-show-hidden",
+	  NULL,
+	  N_("Show Hidde_n Messages"),
+	  NULL,
+	  N_("Show messages that have been temporarily hidden"),
+	  NULL },
+	
+	{ "mail-stop",
+	  GTK_STOCK_STOP,
+	  N_("Cancel"),
+	  NULL,
+	  N_("Cancel the current mail operation"),
+	  G_CALLBACK (action_mail_stop_cb) },
+
+	{ "mail-threads-collapse-all",
+	  NULL,
+	  N_("Collapse All _Threads"),
+	  "<Shift><Control>b",
+	  N_("Collapse all message threads"),
+	  NULL},
+
+	{ "mail-threads-expand-all",
+	  NULL,
+	  N_("E_xpand All Threads"),
+	  NULL,
+	  N_("Expand all message threads"),
+	  NULL },
+
+	{ "mail-tools-filters",
+	  NULL,
+	  N_("_Message Filters"),
+	  NULL,
+	  N_("Create or edit rules for filtering new mail"),
+	  G_CALLBACK (action_mail_tools_filters_cb) },
+
+	{ "mail-tools-search-folders",
+	  NULL,
+	  N_("Search F_olders"),
+	  NULL,
+	  N_("Create or edit search folder definitions"),
+	  G_CALLBACK (action_mail_tools_search_folders_cb) },
+
+	{ "mail-tools-subscriptions",
+	  NULL,
+	  N_("_Subscriptions..."),
+	  NULL,
+	  N_("Subscribe or unsubscribe to folders on remote servers"),
+	  G_CALLBACK (action_mail_tools_subscriptions_cb) },
+
+	/*** Menus ***/
+
+	{ "mail-folder-menu",
+	  NULL,
+	  N_("F_older"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-label-menu",
+	  NULL,
+	  N_("_Label"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-preview-menu",
+	  NULL,
+	  N_("_Preview"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-delete",
+	  NULL,
+	  N_("Delete"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-undelete",
+	  NULL,
+	  N_("Undelete"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-copy",
+	  NULL,
+	  N_("Copy"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-move",
+	  NULL,
+	  N_("Move"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-read",
+	  NULL,
+	  N_("Read"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-unread",
+	  NULL,
+	  N_("Unread"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-important",
+	  NULL,
+	  N_("Important"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-unimportant",
+	  NULL,
+	  N_("Unimportant"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-junk",
+	  NULL,
+	  N_("Junk"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-mark-notjunk",
+	  NULL,
+	  N_("Not Junk"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-popup-flag-for-followup",
+	  NULL,
+	  N_("Followup"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-filter-on-subject",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },	
+
+	{ "mail-create-rule-menu",
+	  NULL,
+	  N_("Rule"),
+	  NULL,
+	  NULL,
+	  NULL },	
+
+	{ "mail-filter-on-sender",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-filter-on-recipients",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-filter-on-mailing-list",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-search-folder-from-subject",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-search-folder-from-sender",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-search-folder-from-recipients",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+
+	{ "mail-search-folder-from-mailing-list",
+	  NULL,
+	  N_("Filter"),
+	  NULL,
+	  NULL,
+	  NULL },
+};
+
+static EPopupActionEntry mail_popup_entries[] = {
+
+	{ "mail-popup-account-disable",
+	  NULL,
+	  "mail-account-disable" },
+
+	{ "mail-popup-empty-trash",
+	  NULL,
+	  "mail-empty-trash" },
+
+	{ "mail-popup-flush-outbox",
+	  NULL,
+	  "mail-flush-outbox" },
+
+	{ "mail-popup-folder-copy",
+	  NULL,
+	  "mail-folder-copy" },
+
+	{ "mail-popup-folder-delete",
+	  NULL,
+	  "mail-folder-delete" },
+
+	{ "mail-popup-folder-move",
+	  NULL,
+	  "mail-folder-move" },
+
+	{ "mail-popup-folder-new",
+	  N_("_New Folder..."),
+	  "mail-folder-new" },
+
+	{ "mail-popup-folder-properties",
+	  NULL,
+	  "mail-folder-properties" },
+
+	{ "mail-popup-folder-refresh",
+	  NULL,
+	  "mail-folder-refresh" },
+
+	{ "mail-popup-folder-rename",
+	  NULL,
+	  "mail-folder-rename" },
+
+	{ "mail-popup-folder-unsubscribe",
+	  NULL,
+	  "mail-folder-unsubscribe" }
+};
+
+static GtkToggleActionEntry mail_toggle_entries[] = {
+
+	{ "mail-hide-deleted",
+	  NULL,
+	  N_("Hide _Deleted Messages"),
+	  NULL,
+	  N_("Hide deleted messages rather than displaying "
+	     "them with a line through them"),
+	  NULL,
+	  TRUE },
+
+	{ "mail-preview",
+	  NULL,
+	  N_("Show Message _Preview"),
+	  "<Control>m",
+	  N_("Show message preview pane"),
+	  NULL,  /* Handled by property bindings */
+	  TRUE },
+
+	{ "mail-threads-group-by",
+	  NULL,
+	  N_("_Group By Threads"),
+	  "<Control>t",
+	  N_("Threaded message list"),
+	  NULL,
+	  FALSE }
+};
+
+static GtkRadioActionEntry mail_view_entries[] = {
+
+	/* This action represents the initial active mail view.
+	 * It should not be visible in the UI, nor should it be
+	 * possible to switch to it from another shell view. */
+	{ "mail-view-initial",
+	  NULL,
+	  NULL,
+	  NULL,
+	  NULL,
+	  -1 },
+
+	{ "mail-view-classic",
+	  NULL,
+	  N_("_Classic View"),
+	  NULL,
+	  N_("Show message preview below the message list"),
+	  0 },
+
+	{ "mail-view-vertical",
+	  NULL,
+	  N_("_Vertical View"),
+	  NULL,
+	  N_("Show message preview alongside the message list"),
+	  1 }
+};
+
+static GtkRadioActionEntry mail_filter_entries[] = {
+
+	{ "mail-filter-all-messages",
+	  NULL,
+	  N_("All Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_ALL_MESSAGES },
+
+	{ "mail-filter-important-messages",
+	  "emblem-important",
+	  N_("Important Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_IMPORTANT_MESSAGES },
+
+	{ "mail-filter-last-5-days-messages",
+	  NULL,
+	  N_("Last 5 Days' Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_LAST_5_DAYS_MESSAGES },
+
+	{ "mail-filter-messages-not-junk",
+	  "mail-mark-notjunk",
+	  N_("Messages Not Junk"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_MESSAGES_NOT_JUNK },
+
+	{ "mail-filter-messages-with-attachments",
+	  "mail-attachment",
+	  N_("Messages with Attachments"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS },
+
+	{ "mail-filter-no-label",
+	  NULL,
+	  N_("No Label"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_NO_LABEL },
+
+	{ "mail-filter-read-messages",
+	  "mail-read",
+	  N_("Read Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_READ_MESSAGES },
+
+	{ "mail-filter-recent-messages",
+	  NULL,
+	  N_("Recent Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_RECENT_MESSAGES },
+
+	{ "mail-filter-unread-messages",
+	  "mail-unread",
+	  N_("Unread Messages"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_FILTER_UNREAD_MESSAGES }
+};
+
+static GtkRadioActionEntry mail_search_entries[] = {
+
+	{ "mail-search-body-contains",
+	  NULL,
+	  N_("Body contains"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_BODY_CONTAINS },
+
+	{ "mail-search-message-contains",
+	  NULL,
+	  N_("Message contains"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_MESSAGE_CONTAINS },
+
+	{ "mail-search-recipients-contain",
+	  NULL,
+	  N_("Recipients contain"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_RECIPIENTS_CONTAIN },
+
+	{ "mail-search-sender-contains",
+	  NULL,
+	  N_("Sender contains"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_SENDER_CONTAINS },
+
+	{ "mail-search-subject-contains",
+	  NULL,
+	  N_("Subject contains"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_SUBJECT_CONTAINS },
+
+	{ "mail-search-subject-or-addresses-contain",
+	  NULL,
+	  N_("Subject or Addresses contain"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN }
+};
+
+static GtkRadioActionEntry mail_scope_entries[] = {
+
+	{ "mail-scope-current-folder",
+	  NULL,
+	  N_("Current Folder"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  MAIL_SCOPE_CURRENT_FOLDER }
+};
+
+void
+anjal_shell_view_actions_init (AnjalShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	EShellContent *shell_content;
+	GtkActionGroup *action_group;
+	GtkRadioAction *radio_action;
+
+	g_return_if_fail (ANJAL_IS_SHELL_VIEW (mail_shell_view));
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+
+	/* Mail Actions */
+	action_group = ACTION_GROUP (MAIL);
+	gtk_action_group_add_actions (
+		action_group, mail_entries,
+		G_N_ELEMENTS (mail_entries), mail_shell_view);
+	e_action_group_add_popup_actions (
+		action_group, mail_popup_entries,
+		G_N_ELEMENTS (mail_popup_entries));
+	gtk_action_group_add_toggle_actions (
+		action_group, mail_toggle_entries,
+		G_N_ELEMENTS (mail_toggle_entries), mail_shell_view);	
+	gtk_action_group_add_radio_actions (
+		action_group, mail_view_entries,
+		G_N_ELEMENTS (mail_view_entries), -1,
+		NULL, mail_shell_view);	
+	gtk_action_group_add_radio_actions (
+		action_group, mail_search_entries,
+		G_N_ELEMENTS (mail_search_entries),
+		MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN,
+		G_CALLBACK (action_mail_search_cb), mail_shell_view);
+#if 0	
+	gtk_action_group_add_radio_actions (
+		action_group, mail_scope_entries,
+		G_N_ELEMENTS (mail_scope_entries),
+		MAIL_SCOPE_CURRENT_FOLDER,
+		G_CALLBACK (action_search_scope_cb), mail_shell_view);
+#endif
+
+	/*
+	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);
+
+}
+
+
+void
+anjal_shell_view_update_popup_labels (AnjalShellView *mail_shell_view)
+{
+
+}
+
+void
+anjal_shell_view_update_search_filter (AnjalShellView *mail_shell_view)
+{
+	EShell *shell;
+	EShellContent *shell_content;
+	EShellSettings *shell_settings;
+	EShellWindow *shell_window;
+	EShellView *shell_view;
+	GtkActionGroup *action_group;
+	GtkRadioAction *radio_action;
+	GtkTreeModel *tree_model;
+	GtkTreeIter iter;
+	GList *list;
+	GSList *group;
+	gboolean valid;
+	gint ii = 0;
+
+	g_return_if_fail (ANJAL_IS_SHELL_VIEW (mail_shell_view));
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	tree_model = e_shell_settings_get_object (
+		shell_settings, "mail-label-list-store");
+
+	action_group = ACTION_GROUP (MAIL_FILTER);
+	e_action_group_remove_all_actions (action_group);
+
+	/* Add the standard filter actions. */
+#if 0	
+	gtk_action_group_add_radio_actions (
+		action_group, mail_filter_entries,
+		G_N_ELEMENTS (mail_filter_entries),
+		MAIL_FILTER_ALL_MESSAGES,
+		G_CALLBACK (action_search_filter_cb),
+		mail_shell_view);
+
+	/* Retrieve the radio group from an action we just added. */
+	list = gtk_action_group_list_actions (action_group);
+	radio_action = GTK_RADIO_ACTION (list->data);
+	group = gtk_radio_action_get_group (radio_action);
+	g_list_free (list);
+
+	valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+
+	while (valid) {
+		GtkAction *action;
+		gchar *action_name;
+		gchar *stock_id;
+		gchar *label;
+
+		label = e_mail_label_list_store_get_name (
+			E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+		stock_id = e_mail_label_list_store_get_stock_id (
+			E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+
+		action_name = g_strdup_printf ("mail-filter-label-%d", ii);
+		radio_action = gtk_radio_action_new (
+			action_name, label, NULL, stock_id, ii);
+		g_free (action_name);
+
+		gtk_radio_action_set_group (radio_action, group);
+		group = gtk_radio_action_get_group (radio_action);
+
+		/* The action group takes ownership of the action. */
+		action = GTK_ACTION (radio_action);
+		gtk_action_group_add_action (action_group, action);
+		g_object_unref (radio_action);
+
+		g_free (label);
+		g_free (stock_id);
+
+		valid = gtk_tree_model_iter_next (tree_model, &iter);
+		ii++;
+	}
+
+	/* Use any action in the group; doesn't matter which. */
+	e_shell_content_set_filter_action (shell_content, radio_action);
+
+	ii = MAIL_FILTER_UNREAD_MESSAGES;
+	e_shell_content_add_filter_separator_after (shell_content, ii);
+
+	ii = MAIL_FILTER_READ_MESSAGES;
+	e_shell_content_add_filter_separator_before (shell_content, ii);
+#endif
+	g_object_unref (tree_model);
+}
diff --git a/src/module/anjal-shell-view-actions.h b/src/module/anjal-shell-view-actions.h
new file mode 100644
index 0000000..c992017
--- /dev/null
+++ b/src/module/anjal-shell-view-actions.h
@@ -0,0 +1,257 @@
+/*
+ * anjal-shell-view-actions.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 ANJAL_SHELL_VIEW_ACTIONS_H
+#define ANJAL_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Mail Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_ACCOUNT_DISABLE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-account-disable")
+#define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-add-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-caret-mode")
+#define E_SHELL_WINDOW_ACTION_MAIL_CHECK_FOR_JUNK(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-check-for-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_CLIPBOARD_COPY(window) \
+	E_SHELL_WINDOw_ACTION ((window), "mail-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_COPY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_CREATE_SEARCH_FOLDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-create-search-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_DELETE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_DOWNLOAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-download")
+#define E_SHELL_WINDOW_ACTION_MAIL_EMPTY_TRASH(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-empty-trash")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_MAILING_LIST(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_RECIPIENTS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SENDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SUBJECT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTERS_APPLY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filters-apply")
+#define E_SHELL_WINDOW_ACTION_MAIL_FIND(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-find")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_CLEAR(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-flag-clear")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_COMPLETED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-flag-completed")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_FOR_FOLLOWUP(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-flag-for-followup")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLUSH_OUTBOX(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-flush-outbox")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_COPY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_DELETE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_EXPUNGE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-expunge")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MARK_ALL_AS_READ(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-mark-all-as-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MOVE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_PROPERTIES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-properties")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_REFRESH(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-refresh")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_RENAME(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-rename")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_ALL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_THREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_SUBTHREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-subthread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_UNSUBSCRIBE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-folder-unsubscribe")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_ATTACHED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-forward-attached")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_INLINE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-hide-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-label-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NONE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-label-none")
+#define E_SHELL_WINDOW_ACTION_MAIL_LOAD_IMAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-load-images")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_IMPORTANT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_JUNK(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_NOTJUNK(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-notjunk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_READ(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNIMPORTANT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-unimportant")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-mark-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_EDIT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-message-edit")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-message-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_OPEN(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-message-open")
+#define E_SHELL_WINDOW_ACTION_MAIL_MOVE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-next")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_IMPORTANT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-next-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_THREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-next-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-next-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-previous")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_IMPORTANT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-previous-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_UNREAD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-previous-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-print")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT_PREVIEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-print-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_REDIRECT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-redirect")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_ALL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-reply-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_LIST(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-reply-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_SENDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-reply-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_MAILING_LIST(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_RECIPIENTS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SENDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SUBJECT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_SELECT_ALL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-smart-backward")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_FORWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-smart-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_STOP(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-stop")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_COLLAPSE_ALL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-threads-collapse-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_EXPAND_ALL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-threads-expand-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_GROUP_BY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-threads-group-by")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_FILTERS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-tools-filters")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SEARCH_FOLDERS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-tools-search-folders")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SUBSCRIPTIONS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions")
+#define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-undelete")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_CLASSIC(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-view-classic")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_VERTICAL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-view-vertical")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_100(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-zoom-100")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_IN(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-zoom-in")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_OUT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-zoom-out")
+
+/* Mail Query Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ALL_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-all-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_IMPORTANT_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-important-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LAST_5_DAYS_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-last-5-days-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_NOT_JUNK(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-not-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-with-attachments")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_NO_LABEL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-no-label")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_READ_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-read-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_RECENT_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-recent-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_UNREAD_MESSAGES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-filter-unread-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_ALL_ACCOUNTS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-scope-all-accounts")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_ACCOUNT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-account")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_FOLDER(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_MESSAGE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-message")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_BODY_CONTAINS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-body-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_MESSAGE_CONTAINS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-message-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_RECIPIENTS_CONTAIN(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-recipients-contain")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SENDER_CONTAINS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-sender-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_CONTAINS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-addresses-contain")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
+	E_SHELL_WINDOW_ACTION_GROUP ((window), "mail")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_FILTER(window) \
+	E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_LABEL(window) \
+	E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-label")
+
+#endif /* ANJAL_SHELL_VIEW_ACTIONS_H */
diff --git a/src/module/anjal-shell-view-private.c b/src/module/anjal-shell-view-private.c
new file mode 100644
index 0000000..19dbbde
--- /dev/null
+++ b/src/module/anjal-shell-view-private.c
@@ -0,0 +1,292 @@
+/*
+ * e-mail-shell-view-private.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 "anjal-shell-view-private.h"
+
+static void
+mail_shell_view_folder_tree_selected_cb (AnjalShellView *mail_shell_view,
+                                         const gchar *full_name,
+                                         const gchar *uri,
+                                         guint32 flags,
+                                         EMFolderTree *folder_tree)
+{
+	EShellView *shell_view;
+	gboolean folder_selected;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+
+	folder_selected =
+		!(flags & CAMEL_FOLDER_NOSELECT) &&
+		full_name != NULL;
+	
+	anjal_mail_view_set_folder_uri (mail_shell_view->priv->view, uri);
+	e_shell_view_update_actions (shell_view);
+}
+
+static gboolean
+mail_shell_view_folder_tree_key_press_event_cb (AnjalShellView *mail_shell_view,
+                                                GdkEventKey *event)
+{
+	gboolean handled = FALSE;
+
+	if ((event->state & GDK_CONTROL_MASK) != 0)
+		goto ctrl;
+
+	/* <keyval> alone */
+	switch (event->keyval) {
+		case GDK_period:
+		case GDK_comma:
+		case GDK_bracketleft:
+		case GDK_bracketright:
+			goto emit;
+
+		default:
+			goto exit;
+	}
+
+ctrl:
+	/* Ctrl + <keyval> */
+	switch (event->keyval) {
+		case GDK_period:
+		case GDK_comma:
+			goto emit;
+
+		default:
+			goto exit;
+	}
+
+	/* All branches jump past this. */
+	g_return_val_if_reached (FALSE);
+
+emit:
+	/* Forward the key press to the EMailReader interface. */
+	;
+exit:
+	return handled;
+}
+
+static void
+mail_shell_view_folder_tree_selection_done_cb (AnjalShellView *mail_shell_view,
+                                               GtkWidget *menu)
+{
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	const gchar *list_uri=NULL;
+	gchar *tree_uri;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	tree_uri = em_folder_tree_get_selected_uri (folder_tree);
+
+	/* If the folder tree and message list disagree on the current
+	 * folder, reset the folder tree to match the message list. */
+	if (g_strcmp0 (tree_uri, list_uri) != 0)
+		em_folder_tree_set_selected (folder_tree, list_uri, FALSE);
+
+	g_free (tree_uri);
+
+	/* Disconnect from the "selection-done" signal. */
+	g_signal_handlers_disconnect_by_func (
+		menu, mail_shell_view_folder_tree_selection_done_cb,
+		mail_shell_view);
+}
+
+static void
+mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
+                                            GdkEventButton *event)
+{
+	GtkWidget *menu;
+	const gchar *widget_path;
+
+	widget_path = "/mail-folder-popup";
+	menu = e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+	g_signal_connect_swapped (
+		menu, "selection-done",
+		G_CALLBACK (mail_shell_view_folder_tree_selection_done_cb),
+		shell_view);
+}
+
+void
+anjal_shell_view_set_mail_view (AnjalShellView *mail_shell_view, 
+				AnjalMailView *mail_view)
+{
+	AnjalShellViewPrivate *priv = mail_shell_view->priv;
+	EShellView *shell_view;
+	EShellSidebar *shell_sidebar;
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	
+	priv->view = mail_view;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+	mail_shell_sidebar = ANJAL_SHELL_SIDEBAR (shell_sidebar);
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	anjal_mail_view_set_folder_tree (mail_shell_view->priv->view, (GtkWidget *)folder_tree);
+}
+
+void
+anjal_shell_view_private_init (AnjalShellView *mail_shell_view,
+                                EShellViewClass *shell_view_class)
+{
+
+}
+
+void
+anjal_shell_view_private_constructed (AnjalShellView *mail_shell_view)
+{
+	AnjalShellViewPrivate *priv = mail_shell_view->priv;
+	AnjalShellSidebar *mail_shell_sidebar;
+	EShell *shell;
+	EShellView *shell_view;
+	EShellBackend *shell_backend;
+	EShellContent *shell_content;
+	EShellSettings *shell_settings;
+	EShellSidebar *shell_sidebar;
+	EShellWindow *shell_window;
+	EMFolderTree *folder_tree;
+	ERuleContext *context;
+	EFilterRule *rule = NULL;
+	GtkTreeSelection *selection;
+	GtkTreeModel *tree_model;
+	GtkUIManager *ui_manager;
+	const gchar *source;
+	guint merge_id;
+	gint ii = 0;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_backend = e_shell_view_get_shell_backend (shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	tree_model = e_shell_settings_get_object (
+		shell_settings, "mail-label-list-store");
+
+	e_shell_window_add_action_group (shell_window, "mail");
+	e_shell_window_add_action_group (shell_window, "mail-filter");
+	e_shell_window_add_action_group (shell_window, "mail-label");
+
+	merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+	priv->label_merge_id = merge_id;
+
+	/* Cache these to avoid lots of awkward casting. */
+	priv->mail_shell_backend = g_object_ref (shell_backend);
+	priv->mail_shell_content = g_object_ref (shell_content);
+	priv->mail_shell_sidebar = g_object_ref (shell_sidebar);
+
+	mail_shell_sidebar = ANJAL_SHELL_SIDEBAR (shell_sidebar);
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
+
+	g_signal_connect_swapped (
+		folder_tree, "folder-selected",
+		G_CALLBACK (mail_shell_view_folder_tree_selected_cb),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
+		folder_tree, "key-press-event",
+		G_CALLBACK (mail_shell_view_folder_tree_key_press_event_cb),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
+		folder_tree, "popup-event",
+		G_CALLBACK (mail_shell_view_folder_tree_popup_event_cb),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
+		tree_model, "row-changed",
+		G_CALLBACK (anjal_shell_view_update_search_filter),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
+		tree_model, "row-deleted",
+		G_CALLBACK (anjal_shell_view_update_search_filter),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
+		tree_model, "row-inserted",
+		G_CALLBACK (anjal_shell_view_update_search_filter),
+		mail_shell_view);
+
+	anjal_shell_view_actions_init (mail_shell_view);
+	anjal_shell_view_update_search_filter (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);
+	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");
+}
+
+void
+anjal_shell_view_private_dispose (AnjalShellView *mail_shell_view)
+{
+	AnjalShellViewPrivate *priv = mail_shell_view->priv;
+	gint ii;
+
+	DISPOSE (priv->mail_shell_backend);
+	DISPOSE (priv->mail_shell_content);
+	DISPOSE (priv->mail_shell_sidebar);
+
+	for (ii = 0; ii < MAIL_NUM_SEARCH_RULES; ii++)
+		DISPOSE (priv->search_rules[ii]);
+}
+
+void
+anjal_shell_view_private_finalize (AnjalShellView *mail_shell_view)
+{
+	/* XXX Nothing to do? */
+}
+
+void
+anjal_shell_view_restore_state (AnjalShellView *mail_shell_view, const char *folder_uri)
+{
+	EShellView *shell_view;
+	EShellContent *shell_content;
+	gchar *group_name;
+
+	/* XXX Move this to EMailShellContent. */
+
+	g_return_if_fail (E_IS_SHELL_VIEW (mail_shell_view));
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+
+	group_name = g_strdup_printf ("Folder %s", folder_uri);
+	e_shell_content_restore_state (shell_content, group_name);
+	g_free (group_name);
+}
+
diff --git a/src/module/anjal-shell-view-private.h b/src/module/anjal-shell-view-private.h
new file mode 100644
index 0000000..0204d24
--- /dev/null
+++ b/src/module/anjal-shell-view-private.h
@@ -0,0 +1,184 @@
+/*
+ * anjal-shell-view-private.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 ANJAL_SHELL_VIEW_PRIVATE_H
+#define ANJAL_SHELL_VIEW_PRIVATE_H
+
+#include "anjal-shell-view.h"
+#include "../anjal-mail-view.h"
+
+#include <glib/gi18n.h>
+#include <gtkhtml/gtkhtml.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-vtrash-folder.h>
+#include <camel/camel-search-private.h>  /* for camel_search_word */
+
+#include <e-util/e-util.h>
+#include <e-util/e-binding.h>
+#include <e-util/gconf-bridge.h>
+#include <e-util/e-account-utils.h>
+#include <filter/e-filter-input.h>
+#include <filter/e-filter-part.h>
+#include <misc/e-web-view.h>
+#include <misc/e-popup-action.h>
+#include <menus/gal-view-instance.h>
+
+#include <mail/e-mail-label-action.h>
+#include <mail/e-mail-label-dialog.h>
+#include <mail/e-mail-label-list-store.h>
+#include <mail/e-mail-local.h>
+#include <mail/e-mail-reader.h>
+#include <mail/e-mail-sidebar.h>
+#include <mail/e-mail-store.h>
+#include <mail/em-composer-utils.h>
+#include <mail/em-folder-properties.h>
+#include <mail/em-folder-selector.h>
+#include <mail/em-folder-utils.h>
+#include <mail/em-search-context.h>
+#include <mail/em-subscribe-editor.h>
+#include <mail/em-utils.h>
+#include <mail/mail-autofilter.h>
+#include <mail/mail-config.h>
+#include <mail/mail-ops.h>
+#include <mail/mail-send-recv.h>
+#include <mail/mail-vfolder.h>
+
+#include "anjal-shell-backend.h"
+#include "anjal-shell-content.h"
+#include "anjal-shell-sidebar.h"
+#include "anjal-shell-view-actions.h"
+
+#define ANJAL_SHELL_VIEW_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+	(E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+	(E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+	G_STMT_START { \
+	if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+	} G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME		"message-list.etspec"
+
+/* State File Keys */
+#define STATE_KEY_SEARCH_FILTER		"SearchFilter"
+#define STATE_KEY_SEARCH_SCOPE		"SearchScope"
+#define STATE_KEY_SEARCH_TEXT		"SearchText"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Labels are numbered from zero, so subsequent items must have
+ * sufficiently large values.  Unfortunately this introduces an
+ * arbitrary upper bound on labels. */
+enum {
+	MAIL_FILTER_ALL_MESSAGES		= -3,
+	MAIL_FILTER_UNREAD_MESSAGES		= -2,
+	MAIL_FILTER_NO_LABEL			= -1,
+	/* Labels go here */
+	MAIL_FILTER_READ_MESSAGES		= 5000,
+	MAIL_FILTER_RECENT_MESSAGES		= 5001,
+	MAIL_FILTER_LAST_5_DAYS_MESSAGES	= 5002,
+	MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS	= 5003,
+	MAIL_FILTER_IMPORTANT_MESSAGES		= 5004,
+	MAIL_FILTER_MESSAGES_NOT_JUNK		= 5005
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+	MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN,
+	MAIL_SEARCH_RECIPIENTS_CONTAIN,
+	MAIL_SEARCH_MESSAGE_CONTAINS,
+	MAIL_SEARCH_SUBJECT_CONTAINS,
+	MAIL_SEARCH_SENDER_CONTAINS,
+	MAIL_SEARCH_BODY_CONTAINS,
+	MAIL_NUM_SEARCH_RULES
+};
+
+/* Scope items are displayed in ascending order. */
+enum {
+	MAIL_SCOPE_CURRENT_FOLDER,
+	MAIL_SCOPE_CURRENT_ACCOUNT,
+	MAIL_SCOPE_ALL_ACCOUNTS
+};
+
+struct _AnjalShellViewPrivate {
+
+	/*** Other Stuff ***/
+
+	/* These are just for convenience. */
+	AnjalShellBackend *mail_shell_backend;
+	AnjalShellContent *mail_shell_content;
+	AnjalShellSidebar *mail_shell_sidebar;
+
+	/* For UI merging and unmerging. */
+	guint merge_id;
+	guint label_merge_id;
+
+	/* Filter rules correspond to the search entry menu. */
+	EFilterRule *search_rules[MAIL_NUM_SEARCH_RULES];
+
+	guint show_deleted : 1;
+
+	AnjalMailView *view;
+};
+
+void		anjal_shell_view_private_init
+					(AnjalShellView *mail_shell_view,
+					 EShellViewClass *shell_view_class);
+void		anjal_shell_view_private_constructed
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_private_dispose
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_private_finalize
+					(AnjalShellView *mail_shell_view);
+
+/* Private Utilities */
+
+void		anjal_shell_view_actions_init
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_restore_state
+					(AnjalShellView *mail_shell_view,
+					 const char *uri);
+void		anjal_shell_view_create_filter_from_selected
+					(AnjalShellView *mail_shell_view,
+					 gint filter_type);
+void		anjal_shell_view_create_vfolder_from_selected
+					(AnjalShellView *mail_shell_view,
+					 gint vfolder_type);
+void		anjal_shell_view_update_popup_labels
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_update_search_filter
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_update_sidebar
+					(AnjalShellView *mail_shell_view);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_VIEW_PRIVATE_H */
diff --git a/src/module/anjal-shell-view.c b/src/module/anjal-shell-view.c
new file mode 100644
index 0000000..f4976b7
--- /dev/null
+++ b/src/module/anjal-shell-view.c
@@ -0,0 +1,608 @@
+/*
+ * anjal-shell-view.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 "anjal-shell-view-private.h"
+
+static gpointer parent_class;
+static GType anjal_shell_view_type;
+
+static void
+anjal_shell_view_dispose (GObject *object)
+{
+	anjal_shell_view_private_dispose (ANJAL_SHELL_VIEW (object));
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+anjal_shell_view_finalize (GObject *object)
+{
+	anjal_shell_view_private_finalize (ANJAL_SHELL_VIEW (object));
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+anjal_shell_view_constructed (GObject *object)
+{
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (parent_class)->constructed (object);
+
+	anjal_shell_view_private_constructed (ANJAL_SHELL_VIEW (object));
+}
+
+static void
+anjal_shell_view_toggled (EShellView *shell_view)
+{
+	AnjalShellViewPrivate *priv;
+
+	priv = ANJAL_SHELL_VIEW_GET_PRIVATE(shell_view);
+
+	/* Chain up to parent's toggled() method. */
+	E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view);
+}
+
+static void
+anjal_shell_view_execute_search (EShellView *shell_view)
+{
+	AnjalShellViewPrivate *priv;
+	EShell *shell;
+	EShellWindow *shell_window;
+	EShellContent *shell_content;
+	EShellSettings *shell_settings;
+	AnjalShellContent *mail_shell_content;
+	EFilterRule *rule;
+	EFilterRule *search_rule;
+	GtkAction *action;
+	GtkTreeModel *model;
+	GString *string;
+	GList *iter;
+	GSList *search_strings = NULL;
+	const gchar *folder_uri;
+	const gchar *text;
+	gchar *query;
+	gchar *temp;
+	gint value;
+	AnjalShellView *anjal_shell_view = (AnjalShellView *)shell_view;
+	EShellSidebar *shell_sidebar;
+	AnjalShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+
+	mail_shell_sidebar = anjal_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+	folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+
+	priv = ANJAL_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell_content = e_shell_view_get_shell_content (shell_view);
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	mail_shell_content = ANJAL_SHELL_CONTENT (shell_content);
+
+	if (folder_uri != NULL) {
+		GKeyFile *key_file;
+		const gchar *key;
+		const gchar *string;
+		gchar *group_name;
+
+		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);
+		group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+		if (string != NULL && *string != '\0')
+			g_key_file_set_string (
+				key_file, group_name, key, string);
+		else
+			g_key_file_remove_key (
+				key_file, group_name, key, NULL);
+		e_shell_view_set_state_dirty (shell_view);
+		g_free (group_name);
+	} 
+
+	/* This returns a new object reference. */
+	model = e_shell_settings_get_object (
+		shell_settings, "mail-label-list-store");
+
+	text = e_shell_content_get_search_text (shell_content);
+	if (text == NULL || *text == '\0') {
+		query = g_strdup ("");
+		goto filter;
+	}
+
+	/* Replace variables in the selected rule with the
+	 * current search text and extract a query string. */
+
+	action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN);
+	value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+	g_return_if_fail (value >= 0 && value < MAIL_NUM_SEARCH_RULES);
+	rule = priv->search_rules[value];
+
+	for (iter = rule->parts; iter != NULL; iter = iter->next) {
+		EFilterPart *part = iter->data;
+		EFilterElement *element = NULL;
+
+		if (strcmp (part->name, "subject") == 0)
+			element = e_filter_part_find_element (part, "subject");
+		else if (strcmp (part->name, "body") == 0)
+			element = e_filter_part_find_element (part, "word");
+		else if (strcmp (part->name, "sender") == 0)
+			element = e_filter_part_find_element (part, "sender");
+		else if (strcmp (part->name, "to") == 0)
+			element = e_filter_part_find_element (part, "recipient");
+
+		if (strcmp (part->name, "body") == 0) {
+			struct _camel_search_words *words;
+			gint ii;
+
+			words = camel_search_words_split ((guchar *) text);
+			for (ii = 0; ii < words->len; ii++)
+				search_strings = g_slist_prepend (
+					search_strings, g_strdup (
+					words->words[ii]->word));
+			camel_search_words_free (words);
+		}
+
+		if (element != NULL) {
+			EFilterInput *input = E_FILTER_INPUT (element);
+			e_filter_input_set_value (input, text);
+		}
+	}
+
+	string = g_string_sized_new (1024);
+	e_filter_rule_build_code (rule, string);
+	query = g_string_free (string, FALSE);
+
+filter:
+#if 0
+	/* Apply selected filter. */
+
+	value = e_shell_content_get_filter_value (shell_content);
+	switch (value) {
+		case MAIL_FILTER_ALL_MESSAGES:
+			break;
+
+		case MAIL_FILTER_UNREAD_MESSAGES:
+			temp = g_strdup_printf (
+				"(and %s (match-all (not "
+				"(system-flag \"Seen\"))))", query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_NO_LABEL:
+			string = g_string_sized_new (1024);
+			g_string_append_printf (
+				string, "(and %s (and ", query);
+			valid = gtk_tree_model_get_iter_first (
+				model, &tree_iter);
+			while (valid) {
+				tag = e_mail_label_list_store_get_tag (
+					E_MAIL_LABEL_LIST_STORE (model),
+					&tree_iter);
+				g_string_append_printf (
+					string, " (match-all (not (or "
+					"(= (user-tag \"label\") \"%s\") "
+					"(user-flag \"$Label%s\") "
+					"(user-flag \"%s\"))))",
+					tag, tag, tag);
+				g_free (tag);
+
+				valid = gtk_tree_model_iter_next (
+					model, &tree_iter);
+			}
+			g_string_append_len (string, "))", 2);
+			g_free (query);
+			query = g_string_free (string, FALSE);
+			break;
+
+		case MAIL_FILTER_READ_MESSAGES:
+			temp = g_strdup_printf (
+				"(and %s (match-all "
+				"(system-flag \"Seen\")))", query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_RECENT_MESSAGES:
+			if (em_utils_folder_is_sent (folder, folder_uri))
+				temp = g_strdup_printf (
+					"(and %s (match-all "
+					"(> (get-sent-date) "
+					"(- (get-current-date) 86400))))",
+					query);
+			else
+				temp = g_strdup_printf (
+					"(and %s (match-all "
+					"(> (get-received-date) "
+					"(- (get-current-date) 86400))))",
+					query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
+			if (em_utils_folder_is_sent (folder, folder_uri))
+				temp = g_strdup_printf (
+					"(and %s (match-all "
+					"(> (get-sent-date) "
+					"(- (get-current-date) 432000))))",
+					query);
+			else
+				temp = g_strdup_printf (
+					"(and %s (match-all "
+					"(> (get-received-date) "
+					"(- (get-current-date) 432000))))",
+					query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS:
+			temp = g_strdup_printf (
+				"(and %s (match-all "
+				"(system-flag \"Attachments\")))", query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_IMPORTANT_MESSAGES:
+			temp = g_strdup_printf (
+				"(and %s (match-all "
+				"(system-flag \"Flagged\")))", query);
+			g_free (query);
+			query = temp;
+			break;
+
+		case MAIL_FILTER_MESSAGES_NOT_JUNK:
+			temp = g_strdup_printf (
+				"(and %s (match-all (not "
+				"(system-flag \"junk\"))))", query);
+			g_free (query);
+			query = temp;
+			break;
+
+		default:
+			/* The action value also serves as a path for
+			 * the label list store.  That's why we number
+			 * the label actions from zero. */
+			path = gtk_tree_path_new_from_indices (value, -1);
+			gtk_tree_model_get_iter (model, &tree_iter, path);
+			gtk_tree_path_free (path);
+
+			tag = e_mail_label_list_store_get_tag (
+				E_MAIL_LABEL_LIST_STORE (model), &tree_iter);
+			temp = g_strdup_printf (
+				"(and %s (match-all (or "
+				"(= (user-tag \"label\") \"%s\") "
+				"(user-flag \"$Label%s\") "
+				"(user-flag \"%s\"))))",
+				query, tag, tag, tag);
+			g_free (tag);
+
+			g_free (query);
+			query = temp;
+			break;
+	}
+#endif
+
+	search_rule = e_shell_content_get_search_rule (shell_content);
+	if (search_rule != NULL) {
+		string = g_string_sized_new (1024);
+		e_filter_rule_build_code (search_rule, string);
+		temp = g_strconcat ("(and", string->str, query, ")", NULL);
+
+		g_free (query);
+		query = temp;
+
+		g_string_free (string, TRUE);
+	}
+
+	if (anjal_shell_view->priv->view)
+		anjal_mail_view_set_search (anjal_shell_view->priv->view, query);
+
+	g_slist_foreach (search_strings, (GFunc) g_free, NULL);
+	g_slist_free (search_strings);
+
+	g_object_unref (model);
+	g_free (query);
+}
+
+static void
+has_unread_mail (GtkTreeModel *model, GtkTreeIter *parent, gboolean is_root, gboolean *has_unread)
+{
+	guint unread = 0;
+	GtkTreeIter iter, child;
+
+	g_return_if_fail (model != NULL);
+	g_return_if_fail (parent != NULL);
+	g_return_if_fail (has_unread != NULL);
+
+	if (is_root) {
+		gboolean is_store = FALSE, is_draft = FALSE;
+
+		gtk_tree_model_get (model, parent,
+			COL_UINT_UNREAD, &unread,
+			COL_BOOL_IS_STORE, &is_store,
+			COL_BOOL_IS_DRAFT, &is_draft,
+			-1);
+
+		if (is_draft || is_store) {
+			*has_unread = FALSE;
+			return;
+		}
+
+		*has_unread = *has_unread || (unread > 0 && unread != ~((guint)0));
+
+		if (*has_unread)
+			return;
+
+		if (!gtk_tree_model_iter_children (model, &iter, parent))
+			return;
+	} else {
+		iter = *parent;
+	}
+
+	do {
+		gtk_tree_model_get (model, &iter, COL_UINT_UNREAD, &unread, -1);
+
+		*has_unread = *has_unread || (unread > 0 && unread != ~((guint)0));
+		if (*has_unread)
+			break;
+
+		if (gtk_tree_model_iter_children (model, &child, &iter))
+			has_unread_mail (model, &child, FALSE, has_unread);
+
+	} while (gtk_tree_model_iter_next (model, &iter) && !*has_unread);
+}
+
+static void
+anjal_shell_view_update_actions (EShellView *shell_view)
+{
+	AnjalShellView *mail_shell_view;
+	AnjalShellContent *mail_shell_content;
+	AnjalShellSidebar *mail_shell_sidebar;
+	EShellSidebar *shell_sidebar;
+	EShellWindow *shell_window;
+	EMFolderTree *folder_tree;
+	EAccount *account = NULL;
+	GtkAction *action;
+	const gchar *label;
+	gchar *uri;
+	gboolean sensitive;
+	guint32 state;
+
+	/* Be descriptive. */
+	gboolean account_is_groupwise = FALSE;
+	gboolean folder_allows_children;
+	gboolean folder_can_be_deleted;
+	gboolean folder_is_junk;
+	gboolean folder_is_outbox;
+	gboolean folder_is_store;
+	gboolean folder_is_trash;
+	gboolean folder_has_unread_rec = FALSE;
+	gboolean folder_tree_and_message_list_agree = TRUE;
+
+	mail_shell_view = ANJAL_SHELL_VIEW (shell_view);
+
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	mail_shell_content = mail_shell_view->priv->mail_shell_content;
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = anjal_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+	state = e_shell_sidebar_check_state (shell_sidebar);
+
+	folder_allows_children =
+		(state & E_MAIL_SIDEBAR_FOLDER_ALLOWS_CHILDREN);
+	folder_can_be_deleted =
+		(state & E_MAIL_SIDEBAR_FOLDER_CAN_DELETE);
+	folder_is_junk =
+		(state & E_MAIL_SIDEBAR_FOLDER_IS_JUNK);
+	folder_is_outbox =
+		(state & E_MAIL_SIDEBAR_FOLDER_IS_OUTBOX);
+	folder_is_store =
+		(state & E_MAIL_SIDEBAR_FOLDER_IS_STORE);
+	folder_is_trash =
+		(state & E_MAIL_SIDEBAR_FOLDER_IS_TRASH);
+
+	uri = em_folder_tree_get_selected_uri (folder_tree);
+	if (uri != NULL) {
+		EMFolderTreeModel *model;
+
+		/* XXX If the user right-clicks on a folder other than what
+		 *     the message list is showing, disable folder rename.
+		 *     Between fetching the CamelFolder asynchronously and
+		 *     knowing when NOT to move the folder tree selection
+		 *     back to where it was to avoid cancelling the inline
+		 *     folder tree editing, it's just too hairy to try to
+		 *     get right.  So we're punting. */
+
+		account = mail_config_get_account_by_source_url (uri);
+
+		/* FIXME This belongs in a GroupWise plugin. */
+		account_is_groupwise =
+			(g_strrstr (uri, "groupwise://") != NULL) &&
+			account != NULL && account->parent_uid != NULL;
+
+		model = em_folder_tree_model_get_default ();
+		if (model) {
+			GtkTreeRowReference *reference = em_folder_tree_model_lookup_uri (model, uri);
+			if (reference != NULL) {
+				GtkTreePath *path = gtk_tree_row_reference_get_path (reference);
+				GtkTreeIter iter;
+
+				gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
+				has_unread_mail (GTK_TREE_MODEL (model), &iter, TRUE, &folder_has_unread_rec);
+				gtk_tree_path_free (path);
+			}
+		}
+
+		g_free (uri);
+	}
+
+	action = ACTION (MAIL_ACCOUNT_DISABLE);
+	sensitive = (account != NULL) && folder_is_store;
+	if (account_is_groupwise)
+		label = _("Proxy _Logout");
+	else
+		label = _("_Disable Account");
+	gtk_action_set_sensitive (action, sensitive);
+	g_object_set (action, "label", label, NULL);
+
+	action = ACTION (MAIL_EMPTY_TRASH);
+	sensitive = folder_is_trash;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FLUSH_OUTBOX);
+	sensitive = folder_is_outbox;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_COPY);
+	sensitive = !folder_is_store;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_DELETE);
+	sensitive = !folder_is_store && folder_can_be_deleted;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_MOVE);
+	sensitive = !folder_is_store && folder_can_be_deleted;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_NEW);
+	sensitive = folder_allows_children;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_PROPERTIES);
+	sensitive = !folder_is_store;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_REFRESH);
+	sensitive = !folder_is_store;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_RENAME);
+	sensitive =
+		!folder_is_store && folder_can_be_deleted &&
+		folder_tree_and_message_list_agree;
+	gtk_action_set_sensitive (action, sensitive);
+
+//	action = ACTION (MAIL_FOLDER_SELECT_ALL);
+//	sensitive = !folder_is_store;
+//	gtk_action_set_sensitive (action, sensitive);
+
+//	action = ACTION (MAIL_FOLDER_SELECT_THREAD);
+//	sensitive = !folder_is_store;
+//	gtk_action_set_sensitive (action, sensitive);
+
+//	action = ACTION (MAIL_FOLDER_SELECT_SUBTHREAD);
+//	sensitive = !folder_is_store;
+//	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MAIL_FOLDER_UNSUBSCRIBE);
+	sensitive = !folder_is_store && folder_can_be_deleted;
+	gtk_action_set_sensitive (action, sensitive);
+
+//	action = ACTION (MAIL_FOLDER_MARK_ALL_AS_READ);
+//	sensitive = folder_has_unread_rec && !folder_is_store;
+//	gtk_action_set_sensitive (action, sensitive);
+
+	anjal_shell_view_update_popup_labels (mail_shell_view);
+}
+
+static void
+anjal_shell_view_class_init (AnjalShellViewClass *class,
+                            GTypeModule *type_module)
+{
+	GObjectClass *object_class;
+	EShellViewClass *shell_view_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (AnjalShellViewPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->dispose = anjal_shell_view_dispose;
+	object_class->finalize = anjal_shell_view_finalize;
+	object_class->constructed = anjal_shell_view_constructed;
+
+	shell_view_class = E_SHELL_VIEW_CLASS (class);
+	shell_view_class->label = _("Mail");
+	shell_view_class->icon_name = "evolution-mail";
+	shell_view_class->ui_definition = "evolution-mail.ui";
+	shell_view_class->ui_manager_id = "org.gnome.evolution.mail";
+	shell_view_class->search_context_type = EM_SEARCH_TYPE_CONTEXT;
+	shell_view_class->search_options = "/mail-search-options";
+	shell_view_class->search_rules = "searchtypes.xml";
+	shell_view_class->new_shell_content = anjal_shell_content_new;
+	shell_view_class->new_shell_sidebar = anjal_shell_sidebar_new;
+	shell_view_class->toggled = anjal_shell_view_toggled;
+	shell_view_class->execute_search = anjal_shell_view_execute_search;
+	shell_view_class->update_actions = anjal_shell_view_update_actions;
+}
+
+static void
+anjal_shell_view_init (AnjalShellView *mail_shell_view,
+                      EShellViewClass *shell_view_class)
+{
+	mail_shell_view->priv =
+		ANJAL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
+
+	anjal_shell_view_private_init (mail_shell_view, shell_view_class);
+}
+
+GType
+anjal_shell_view_get_type (void)
+{
+	return anjal_shell_view_type;
+}
+
+void
+anjal_shell_view_register_type (GTypeModule *type_module)
+{
+	const GTypeInfo type_info = {
+		sizeof (AnjalShellViewClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) anjal_shell_view_class_init,
+		(GClassFinalizeFunc) NULL,
+		NULL,  /* class_data */
+		sizeof (AnjalShellView),
+		0,     /* n_preallocs */
+		(GInstanceInitFunc) anjal_shell_view_init,
+		NULL   /* value_table */
+	};
+
+	anjal_shell_view_type = g_type_module_register_type (
+		type_module, E_TYPE_SHELL_VIEW,
+		"AnjalShellView", &type_info, 0);
+}
diff --git a/src/module/anjal-shell-view.h b/src/module/anjal-shell-view.h
new file mode 100644
index 0000000..89d6fcd
--- /dev/null
+++ b/src/module/anjal-shell-view.h
@@ -0,0 +1,77 @@
+/*
+ * anjal-shell-view.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 ANJAL_SHELL_VIEW_H
+#define ANJAL_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+
+#include "../anjal-mail-view.h"
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_VIEW \
+	(anjal_shell_view_get_type ())
+#define ANJAL_SHELL_VIEW(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellView))
+#define ANJAL_SHELL_VIEW_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewClass))
+#define ANJAL_IS_SHELL_VIEW(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ANJAL_TYPE_SHELL_VIEW))
+#define ANJAL_IS_SHELL_VIEW_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), ANJAL_TYPE_SHELL_VIEW))
+#define ANJAL_SHELL_VIEW_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellView AnjalShellView;
+typedef struct _AnjalShellViewClass AnjalShellViewClass;
+typedef struct _AnjalShellViewPrivate AnjalShellViewPrivate;
+
+struct _AnjalShellView {
+	EShellView parent;
+	AnjalShellViewPrivate *priv;
+};
+
+struct _AnjalShellViewClass {
+	EShellViewClass parent_class;
+};
+
+GType		anjal_shell_view_get_type	(void);
+void		anjal_shell_view_register_type
+					(GTypeModule *type_module);
+gboolean	anjal_shell_view_get_show_deleted
+					(AnjalShellView *mail_shell_view);
+void		anjal_shell_view_set_show_deleted
+					(AnjalShellView *mail_shell_view,
+					 gboolean show_deleted);
+void		anjal_shell_view_set_mail_view 
+					(AnjalShellView *mail_shell_view, 
+					 AnjalMailView *mail_view);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_VIEW_H */



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