aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@gnome.org>2010-02-26 17:16:21 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-14 09:49:49 +0800
commitc38f7da6ed1eb22494fb989aacbff36414fcdd97 (patch)
tree4d7cdf325110072f15fa3ffebf256c82209cee5a
parent304777ae4cd03026fcee98c0863e9e43f483c97a (diff)
downloadgsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar.gz
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar.bz2
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar.lz
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar.xz
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.tar.zst
gsoc2013-evolution-c38f7da6ed1eb22494fb989aacbff36414fcdd97.zip
Add control center capplet from anjal to evolution. Name it
evolution-settings.
-rw-r--r--Makefile.am1
-rw-r--r--capplet/Makefile.am72
-rw-r--r--capplet/anjal-mail-view.c139
-rw-r--r--capplet/anjal-mail-view.h76
-rw-r--r--capplet/anjal-settings-main.c319
-rw-r--r--capplet/mail-account-view.c752
-rw-r--r--capplet/mail-account-view.h94
-rw-r--r--capplet/mail-capplet-shell.c464
-rw-r--r--capplet/mail-capplet-shell.h58
-rw-r--r--capplet/mail-decoration.c354
-rw-r--r--capplet/mail-decoration.h69
-rw-r--r--capplet/mail-guess-servers.c274
-rw-r--r--capplet/mail-guess-servers.h51
-rw-r--r--capplet/mail-settings-view.c298
-rw-r--r--capplet/mail-settings-view.h59
-rw-r--r--capplet/mail-view.c914
-rw-r--r--capplet/mail-view.h97
-rw-r--r--configure.ac1
-rw-r--r--data/Makefile.am3
-rw-r--r--data/evolution-settings.desktop.in.in11
20 files changed, 4105 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 46355d2e8e..72d0690bf1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ SUBDIRS = \
views \
po \
sounds \
+ capplet \
$(HELP_SUBDIR)
DISTCLEANFILES = \
diff --git a/capplet/Makefile.am b/capplet/Makefile.am
new file mode 100644
index 0000000000..829e01d9ac
--- /dev/null
+++ b/capplet/Makefile.am
@@ -0,0 +1,72 @@
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/widgets/misc \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/em-format \
+ -I$(top_srcdir)/mail \
+ -I$(top_srcdir)/composer \
+ -I$(top_builddir)/composer \
+ -I$(top_builddir)/shell \
+ -I$(top_srcdir)/shell \
+ -I$(top_srcdir)/smime/lib \
+ -I$(top_srcdir)/smime/gui \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(EVOLUTION_MAIL_CFLAGS) \
+ $(CERT_UI_CFLAGS) \
+ $(CANBERRA_CFLAGS) \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \
+ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
+ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
+ -DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -DEVOLUTION_UIDIR=\""$(uidir)"\" \
+ -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DG_LOG_DOMAIN=\"evolution-mail\" \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\"
+
+AM_CFLAGS =\
+ -Wall\
+ -g -O0
+
+bin_PROGRAMS = evolution-settings
+
+evolution_settings_SOURCES = \
+ anjal-settings-main.c \
+ mail-settings-view.c \
+ mail-settings-view.h \
+ mail-account-view.c \
+ mail-account-view.h \
+ mail-view.c \
+ mail-view.h \
+ mail-capplet-shell.c \
+ mail-capplet-shell.h \
+ mail-decoration.c \
+ mail-decoration.h \
+ anjal-mail-view.h \
+ anjal-mail-view.c \
+ mail-guess-servers.c \
+ mail-guess-servers.h
+
+evolution_settings_CFLAGS = -DANJAL_SETTINGS
+
+evolution_settings_LDFLAGS = \
+ -Wl,--export-dynamic
+
+evolution_settings_LDADD = \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(CERT_UI_LIBS) \
+ $(CANBERRA_LIBS) \
+ $(GTKHTML_LIBS) \
+ $(E_WIDGETS_LIBS) \
+ $(SMIME_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/filter/libfilter.la \
+ $(top_builddir)/mail/libevolution-mail.la
+
diff --git a/capplet/anjal-mail-view.c b/capplet/anjal-mail-view.c
new file mode 100644
index 0000000000..5178b56422
--- /dev/null
+++ b/capplet/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/capplet/anjal-mail-view.h b/capplet/anjal-mail-view.h
new file mode 100644
index 0000000000..647d07b29a
--- /dev/null
+++ b/capplet/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/capplet/anjal-settings-main.c b/capplet/anjal-settings-main.c
new file mode 100644
index 0000000000..80943f533f
--- /dev/null
+++ b/capplet/anjal-settings-main.c
@@ -0,0 +1,319 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * 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 Intel Corporation (www.intel.com)
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <libedataserverui/e-passwords.h>
+#include <mail/mail-mt.h>
+#include "mail-capplet-shell.h"
+#include <gconf/gconf-client.h>
+#include <libedataserver/e-categories.h>
+#include <dbus/dbus-glib.h>
+
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include <unique/unique.h>
+
+gboolean windowed = FALSE;
+gboolean anjal_icon_decoration = FALSE;
+gboolean default_app = FALSE;
+guint32 socket_id = 0;
+MailCappletShell *main_window;
+static gchar **remaining_args;
+extern char *shell_moduledir;
+
+#define GCONF_KEY_MAILTO_ENABLED "/desktop/gnome/url-handlers/mailto/enabled"
+#define GCONF_KEY_MAILTO_COMMAND "/desktop/gnome/url-handlers/mailto/command"
+#define ANJAL_MAILTO_COMMAND "anjal %s"
+
+static UniqueResponse
+mail_message_received_cb (UniqueApp *app G_GNUC_UNUSED,
+ gint command,
+ UniqueMessageData *message_data,
+ guint time_ G_GNUC_UNUSED,
+ gpointer user_data)
+{
+ gchar *url;
+ GtkWindow *window = (GtkWindow *) user_data;
+ char *args[2];
+
+ switch (command) {
+ case UNIQUE_ACTIVATE :
+ gtk_window_deiconify (window);
+ gtk_window_present (window);
+ return UNIQUE_RESPONSE_OK;
+
+ case UNIQUE_NEW :
+ return UNIQUE_RESPONSE_OK;
+
+ case UNIQUE_OPEN :
+ url = unique_message_data_get_text (message_data);
+ args[0] = url;
+ args[1] = NULL;
+ //mail_shell_set_cmdline_args ((MailShell *)window, args);
+ //mail_shell_handle_cmdline ((MailShell *)window);
+ g_free (url);
+ gdk_window_raise (((GtkWidget *)window)->window);
+ gtk_window_deiconify (window);
+ gtk_window_present (window);
+
+ return UNIQUE_RESPONSE_OK;
+ }
+
+ return UNIQUE_RESPONSE_PASSTHROUGH;
+}
+
+static void
+categories_icon_theme_hack (void)
+{
+ GtkIconTheme *icon_theme;
+ const gchar *category_name;
+ const gchar *filename;
+ gchar *dirname;
+
+ /* XXX Allow the category icons to be referenced as named
+ * icons, since GtkAction does not support GdkPixbufs. */
+
+ /* Get the icon file for some default category. Doesn't matter
+ * which, so long as it has an icon. We're just interested in
+ * the directory components. */
+ category_name = _("Birthday");
+ filename = e_categories_get_icon_file_for (category_name);
+ g_return_if_fail (filename != NULL && *filename != '\0');
+
+ /* Extract the directory components. */
+ dirname = g_path_get_dirname (filename);
+
+ /* Add it to the icon theme's search path. This relies on
+ * GtkIconTheme's legacy feature of using image files found
+ * directly in the search path. */
+ icon_theme = gtk_icon_theme_get_default ();
+ gtk_icon_theme_append_search_path (icon_theme, dirname);
+
+ g_free (dirname);
+}
+
+static void
+check_and_set_default_mail (void)
+{
+ GConfClient *client = gconf_client_get_default ();
+ gchar *mailer;
+
+ mailer = gconf_client_get_string(client, GCONF_KEY_MAILTO_COMMAND, NULL);
+ if (mailer && *mailer && (strcmp (mailer, ANJAL_MAILTO_COMMAND) == 0)) {
+ g_object_unref (client);
+ return; /* Anjal is the default mailer */
+ }
+
+ gconf_client_set_bool(client, GCONF_KEY_MAILTO_ENABLED, TRUE, NULL);
+ gconf_client_set_string(client, GCONF_KEY_MAILTO_COMMAND, ANJAL_MAILTO_COMMAND, NULL);
+ g_object_unref (client);
+}
+
+static gboolean
+idle_cb (MailCappletShell *mshell G_GNUC_UNUSED)
+{
+
+ if (default_app) {
+ check_and_set_default_mail ();
+ }
+
+
+
+ return FALSE;
+}
+
+static void
+create_default_shell (void)
+{
+ main_window = mail_capplet_shell_new(socket_id);
+ if (!socket_id)
+ gtk_widget_show (main_window);
+ g_idle_add ((GSourceFunc) idle_cb, remaining_args);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GError *error = NULL;
+ EShell *default_shell;
+ GConfClient *client;
+
+ UniqueApp *app;
+
+#ifdef G_OS_WIN32
+ extern void link_shutdown (void);
+ set_paths ();
+#endif
+
+ static GOptionEntry entries[] = {
+ { "windowed", 'w', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_NONE, &windowed,N_("Run Anjal in a window"), NULL },
+ { "default-mailer", 'd', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_NONE, &default_app,N_("Make Anjal the default email client"), NULL },
+ { "socket",
+ 's',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_INT,
+ &socket_id,
+ /* TRANSLATORS: don't translate the terms in brackets */
+ N_("ID of the socket to embed in"),
+ N_("socket") },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, NULL },
+ { NULL, 0, 0, 0, NULL, NULL, NULL }
+ };
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+
+ gtk_set_locale ();
+
+ if (!gtk_init_with_args (&argc, &argv, _("Anjal email client"), entries, NULL, &error)) {
+ g_error ("Unable to start Anjal: %s\n", error->message);
+ g_error_free(error);
+ }
+
+ if (!g_thread_get_initialized ())
+ g_thread_init (NULL);
+ dbus_g_thread_init ();
+
+ client = gconf_client_get_default();
+
+ e_passwords_init();
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default(), PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "anjal" G_DIR_SEPARATOR_S "icons");
+ categories_icon_theme_hack ();
+
+ gconf_client_set_bool (client, "/apps/evolution/mail/display/enable_vfolders", FALSE, NULL);
+ g_object_unref (client);
+
+ app = unique_app_new ("org.gnome.AnjalSettings", NULL);
+ if (unique_app_is_running (app) && !socket_id) {
+ gboolean cmd_line = (remaining_args && remaining_args[0] != NULL);
+
+ if (!cmd_line)
+ unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
+ else {
+ UniqueMessageData *data = unique_message_data_new ();
+ unique_message_data_set_text (data, remaining_args[0], -1);
+ unique_app_send_message (app, UNIQUE_OPEN, data);
+ unique_message_data_free (data);
+ }
+
+ return 0;
+ }
+
+ create_default_shell ();
+
+ g_signal_connect (UNIQUE_APP(app), "message-received",
+ G_CALLBACK (mail_message_received_cb), main_window);
+
+ if (windowed)
+ anjal_icon_decoration = TRUE;
+
+ gtk_main ();
+
+
+#ifdef G_OS_WIN32
+ link_shutdown ();
+#endif
+ return 0;
+}
+
+#ifndef HACK
+gpointer em_format_html_print_new(gpointer p1 G_GNUC_UNUSED,
+ int i G_GNUC_UNUSED)
+{
+ return NULL;
+}
+
+void em_format_html_print_raw_message (gpointer p1 G_GNUC_UNUSED,
+ gpointer p2 G_GNUC_UNUSED)
+{
+ return ;
+}
+
+void
+eab_merging_book_commit_contact ()
+{
+}
+
+void
+e_searching_tokenizer_set_primary_case_sensitivity ()
+{
+}
+
+void
+eab_prompt_save_dialog ()
+{
+}
+
+void
+eab_merging_book_add_contact ()
+{
+}
+
+void
+e_searching_tokenizer_match_count ()
+{
+}
+
+void
+addressbook_load_cancel()
+{
+}
+
+void
+e_searching_tokenizer_new ()
+{
+}
+
+void
+e_searching_tokenizer_set_primary_search_string()
+{
+}
+
+void
+addressbook_load()
+{
+}
+
+void
+eab_load_error_dialog()
+{
+}
+
+#endif
diff --git a/capplet/mail-account-view.c b/capplet/mail-account-view.c
new file mode 100644
index 0000000000..95838d1b89
--- /dev/null
+++ b/capplet/mail-account-view.c
@@ -0,0 +1,752 @@
+/*
+ * 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 <glib/gi18n.h>
+#include "mail-account-view.h"
+#include <libedataserver/e-account-list.h>
+#include "mail-view.h"
+#include "e-util/e-config.h"
+#include "mail/mail-config.h"
+#include "mail-guess-servers.h"
+
+extern gboolean anjal_icon_decoration;
+
+struct _MailAccountViewPrivate {
+ GtkWidget *tab_str;
+};
+
+G_DEFINE_TYPE (MailAccountView, mail_account_view, GTK_TYPE_VBOX)
+
+enum {
+ VIEW_CLOSE,
+ LAST_SIGNAL
+};
+
+enum {
+ ERROR_NO_FULLNAME = 1,
+ ERROR_NO_EMAIL = 2,
+ ERROR_INVALID_EMAIL = 3,
+};
+
+struct _dialog_errors {
+ int error;
+ char *detail;
+} dialog_errors[] = {
+ { ERROR_NO_FULLNAME, N_("Please enter your full name.") },
+ { ERROR_NO_EMAIL, N_("Please enter your email address.") },
+ { ERROR_INVALID_EMAIL, N_("The email addres you have entered is invalid.") },
+};
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void
+mail_account_view_init (MailAccountView *shell)
+{
+ shell->priv = g_new0(MailAccountViewPrivate, 1);
+
+}
+
+static void
+mail_account_view_finalize (GObject *object)
+{
+ /*MailAccountView *shell = (MailAccountView *)object;*/
+
+ G_OBJECT_CLASS (mail_account_view_parent_class)->finalize (object);
+}
+
+static void
+mail_account_view_class_init (MailAccountViewClass *klass)
+{
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+
+ mail_account_view_parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = mail_account_view_finalize;
+
+ signals[VIEW_CLOSE] =
+ g_signal_new ("view-close",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (MailAccountViewClass , view_close),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+}
+
+#ifdef NOT_USED
+
+enum {
+ GMAIL = 0,
+ YAHOO,
+ AOL
+};
+struct _server_prefill {
+ char *key;
+ char *recv;
+ char *send;
+ char *proto;
+ char *ssl;
+} std_server [] = {
+ {"gmail", "imap.gmail.com", "smtp.gmail.com", "imap", "always"},
+ {"yahoo", "pop3.yahoo.com", "smtp.yahoo.com", "pop", "never"},
+ {"aol", "imap.aol.com", "smtp.aol.com", "pop", "never"},
+ {"msn", "pop3.email.msn.com", "smtp.email.msn.com", "pop", "never"}
+};
+static int
+check_servers (char *server)
+{
+ int len = G_N_ELEMENTS(std_server), i;
+
+ for (i=0; i<len; i++) {
+ if (strstr(server, std_server[i].key) != NULL)
+ return i;
+ }
+
+ return -1;
+}
+#endif
+static void
+save_identity (MailAccountView *view)
+{
+#if 0
+ if (!view->original) {
+ char *tmp = e_account_get_string(view->edit->account, E_ACCOUNT_ID_ADDRESS);
+ char **token;
+ int index;
+
+ if (tmp && *tmp) {
+ token = g_strsplit (tmp, "@", 2);
+ index = check_servers(token[1]);
+
+ if (index != -1) {
+ char *uri = e_account_get_string(view->edit->account, E_ACCOUNT_SOURCE_URL);
+ CamelURL *url;
+ if (uri == NULL || (url = camel_url_new(uri, NULL)) == NULL)
+ return;
+
+ if (strcmp(url->protocol, std_server[index].proto)) {
+ camel_url_set_protocol (url, std_server[index].proto);
+ g_datalist_clear (&url->params);
+ }
+ camel_url_set_param(url, "use_ssl", std_server[index].ssl);
+ camel_url_set_host (url, std_server[index].recv);
+ camel_url_set_user (url, token[0]);
+ uri = camel_url_to_string(url, 0);
+ e_account_set_string(view->edit->account, E_ACCOUNT_SOURCE_URL, uri);
+ g_free(uri);
+
+ uri = e_account_get_string(view->edit->account, E_ACCOUNT_TRANSPORT_URL);
+ if (uri == NULL || (url = camel_url_new(uri, NULL)) == NULL)
+ return;
+
+ camel_url_set_protocol (url, "smtp");
+ camel_url_set_param(url, "use_ssl", std_server[index].ssl);
+ camel_url_set_host (url, std_server[index].recv);
+ camel_url_set_user (url, token[0]);
+ uri = camel_url_to_string(url, 0);
+ e_account_set_string(view->edit->account, E_ACCOUNT_TRANSPORT_URL, uri);
+ g_free(uri);
+ }
+ g_strfreev(token);
+ }
+ }
+#endif
+}
+
+static int
+validate_identity (MailAccountView *view)
+{
+ char *user = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_NAME);
+ char *email = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_ADDRESS);
+ char *tmp;
+
+ if (!user || !*user)
+ return ERROR_NO_FULLNAME;
+ if (!email || !*email)
+ return ERROR_NO_EMAIL;
+ tmp = strchr(email, '@');
+ if (!tmp || tmp[1] == 0)
+ return ERROR_INVALID_EMAIL;
+
+ return 0;
+}
+#ifdef NOT_USED
+static void
+save_send (MailAccountView *view)
+{
+}
+
+static void
+save_account (MailAccountView *view)
+{
+}
+#endif
+
+#define PACK_BOX(w) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 12); gtk_widget_show(box);
+#define PACK_BOXF(w) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 0); gtk_widget_show(box);
+
+static GtkWidget *
+create_review (MailAccountView *view)
+{
+ GtkWidget *table, *box, *label, *entry;
+ char *uri;
+ char *enc;
+ CamelURL *url;
+
+ uri = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_SOURCE_URL);
+ if (!uri || (url = camel_url_new(uri, NULL)) == NULL)
+ return NULL;
+
+ table = gtk_table_new (4,2, FALSE);
+ gtk_table_set_row_spacings ((GtkTable *)table, 4);
+
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Personal details:</span>"));
+ gtk_widget_show (label);
+ PACK_BOXF(label)
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Name:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new(e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_NAME));
+ gtk_widget_show(entry);
+ PACK_BOX(entry)
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Email address:"));
+ gtk_widget_show (label);
+ PACK_BOX(label)
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_ADDRESS));
+ gtk_widget_show(entry);
+ PACK_BOX(entry)
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Receiving details:</span>"));
+ gtk_widget_show (label);
+ PACK_BOXF(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Server type:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 4, 5, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->protocol);
+ gtk_widget_show(entry);
+ PACK_BOX(entry)
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 4, 5, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Server address:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 5, 6, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->host);
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 5, 6, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+
+ label = gtk_label_new (_("Username:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 6, 7, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->user);
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 6, 7, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Use encryption:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 7, 8, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ enc = (char *)camel_url_get_param(url, "use_ssl");
+ entry = gtk_label_new (enc ? enc : _("never"));
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 7, 8, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+
+ camel_url_free(url);
+ uri =(char *) e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_TRANSPORT_URL);
+ if (!uri || (url = camel_url_new(uri, NULL)) == NULL)
+ return NULL;
+
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Sending details:</span>"));
+ gtk_widget_show (label);
+ PACK_BOXF(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 8, 9, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Server type:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 9, 10, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->protocol);
+ gtk_widget_show(entry);
+ PACK_BOX(entry)
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 9, 10, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Server address:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 10, 11, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->host);
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 10, 11, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+
+ label = gtk_label_new (_("Username:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 11, 12, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ entry = gtk_label_new (url->user);
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 11, 12, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+ label = gtk_label_new (_("Use encryption:"));
+ gtk_widget_show (label);
+ PACK_BOX(label);
+ gtk_table_attach ((GtkTable *)table, box, 0, 1, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ enc = (char *)camel_url_get_param(url, "use_ssl");
+ entry = gtk_label_new (enc ? enc : _("never"));
+ gtk_widget_show(entry);
+ PACK_BOX(entry);
+ gtk_table_attach ((GtkTable *)table, box, 1, 2, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+
+/*
+ label = gtk_label_new (_("Organization:"));
+ gtk_widget_show (label);
+ entry = gtk_entry_new ();
+ gtk_widget_show(entry);
+ gtk_table_attach (table, label, 0, 1, 3, 4, GTK_SHRINK, GTK_SHRINK, 10, 3);
+ gtk_table_attach (table, entry, 1, 2, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
+ */
+
+ gtk_widget_show(table);
+
+ return table;
+}
+
+#define IDENTITY_DETAIL N_("To use the email application you'll need to setup an account. Put your email address and password in below and we'll try and work out all the settings. If we can't do it automatically you'll need your server details as well.")
+
+#define RECEIVE_DETAIL N_("Sorry, we can't work out the settings to get your mail automatically. Please enter them below. We've tried to make a start with the details you just entered but you may need to change them.")
+
+#define RECEIVE_OPT_DETAIL N_("You can specify more options to configure the account.")
+
+#define SEND_DETAIL N_("Now we need your settings for sending mail. We've tried to make some guesses but you should check them over to make sure.")
+#define DEFAULTS_DETAIL N_("You can specify your default settings for your account.")
+#define REVIEW_DETAIL N_("Time to check things over before we try and connect to the server and fetch your mail.")
+struct _page_text {
+ int id;
+ char *head;
+ char *next;
+ char *prev;
+ char *next_edit;
+ char *prev_edit;
+ char *detail;
+ char *path;
+ GtkWidget * (*create_page) (MailAccountView *view);
+ void (*fill_page) (MailAccountView *view);
+ void (*save_page) (MailAccountView *view);
+ int (*validate_page) (MailAccountView *view);
+} mail_account_pages[] = {
+ //{ MAV_IDENTITY_PAGE, N_("Identity"), N_("Next - Receiving mail"), NULL, IDENTITY_DETAIL, create_identity_page, fill_identity, save_identity },
+ //{ MAV_RECV_PAGE, N_("Receiving mail"), N_("Next - Sending mail"), N_("Back - Identity"), RECEIVE_DETAIL, create_receive_page, fill_receive, save_receive},
+ //{ MAV_SEND_PAGE, N_("Sending mail"), N_("Next - Review account"), N_("Back - Receiving mail"), SEND_DETAIL, create_send_page, fill_send, save_send},
+ //{ MAV_REVIEW_PAGE, N_("Review account"), N_("Finish"), N_("Back - Sending"), REVIEW_DETAIL, NULL, NULL, save_account},
+
+ { MAV_IDENTITY_PAGE, N_("Identity"), N_("Next - Receiving mail"), NULL, N_("Next - Receiving mail"), NULL, IDENTITY_DETAIL, "00.identity",NULL, NULL, save_identity, validate_identity},
+ { MAV_RECV_PAGE, N_("Receiving mail"), N_("Next - Sending mail"), N_("Back - Identity"), N_("Next - Receiving options"), N_("Back - Identity"), RECEIVE_DETAIL, "10.receive", NULL, NULL, NULL, NULL },
+ { MAV_RECV_OPT_PAGE, N_("Receiving options"), NULL, NULL, N_("Next - Sending mail"), N_("Back - Receiving mail"), RECEIVE_OPT_DETAIL, "10.receive", NULL, NULL, NULL, NULL },
+
+ { MAV_SEND_PAGE, N_("Sending mail"), N_("Next - Review account"), N_("Back - Receiving mail"), N_("Next - Defaults"), N_("Back - Receiving options"), SEND_DETAIL, "30.send", NULL, NULL, NULL, NULL},
+ { MAV_DEFAULTS_PAGE, N_("Defaults"), NULL, NULL, N_("Next - Review account"), N_("Back - Sending mail"), DEFAULTS_DETAIL, "40.defaults", NULL, NULL, NULL, NULL},
+
+ { MAV_REVIEW_PAGE, N_("Review account"), N_("Finish"), N_("Back - Sending"), N_("Finish"), N_("Back - Sending"), REVIEW_DETAIL, NULL, create_review, NULL, NULL},
+};
+
+static void
+mav_next_pressed (GtkButton *button, MailAccountView *mav)
+{
+ if (mail_account_pages[mav->current_page].validate_page) {
+ int ret = (*mail_account_pages[mav->current_page].validate_page) (mav);
+ MAVPage *page = mav->pages[mav->current_page];
+ if (ret) {
+ gtk_label_set_text ((GtkLabel *)page->error_label, _(dialog_errors[ret-1].detail));
+ gtk_widget_show (page->error);
+ return;
+ }
+ gtk_widget_hide (page->error);
+ gtk_label_set_text ((GtkLabel *)page->error_label, "");
+ }
+ if (mail_account_pages[mav->current_page].save_page) {
+ (*mail_account_pages[mav->current_page].save_page) (mav);
+ }
+
+ if (mav->current_page == MAV_LAST - 1) {
+ char *uri = (char *)e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_URL);
+ CamelURL *url;
+
+ e_account_set_string (em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_NAME, e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_ID_ADDRESS));
+ if (uri != NULL && (url = camel_url_new(uri, NULL)) != NULL) {
+ camel_url_set_param(url, "check_all", "1");
+ camel_url_set_param(url, "sync_offline", "1");
+ if (!mav->original) {
+ e_account_set_bool(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_AUTO_CHECK, TRUE);
+ }
+
+ if (!mav->original && strcmp(url->protocol, "pop") == 0) {
+ e_account_set_bool (em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_KEEP_ON_SERVER, TRUE);
+ }
+
+ uri = camel_url_to_string(url, 0);
+ e_account_set_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_URL, uri);
+ g_free(uri);
+ camel_url_free(url);
+ }
+ em_account_editor_commit (mav->edit);
+ g_signal_emit (mav, signals[VIEW_CLOSE], 0);
+ return;
+ }
+
+ gtk_widget_hide (mav->pages[mav->current_page]->box);
+ mav->current_page++;
+ if (mav->current_page == MAV_RECV_OPT_PAGE && mav->original == NULL)
+ mav->current_page++; /* Skip recv options in new account creation. */
+ if (mav->current_page == MAV_DEFAULTS_PAGE && mav->original == NULL)
+ mav->current_page++; /* Skip defaults in new account creation. */
+
+ if (mav->current_page == MAV_LAST - 1) {
+ MAVPage *page = mav->pages[mav->current_page];
+ GtkWidget *tmp;
+
+ if (page->main)
+ gtk_widget_destroy (page->main);
+
+ tmp = mail_account_pages[mav->current_page].create_page(mav);
+ page->main = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (page->main);
+ gtk_box_pack_start((GtkBox *)page->main, tmp, FALSE, FALSE, 0);
+ gtk_widget_show(tmp);
+ gtk_box_pack_start((GtkBox *)page->box, page->main, FALSE, FALSE, 3);
+ }
+
+ gtk_widget_show (mav->pages[mav->current_page]->box);
+ if (!mav->pages[mav->current_page]->done) {
+ mav->pages[mav->current_page]->done = TRUE;
+ if (mail_account_pages[mav->current_page].path) {
+
+ if (!mav->original && em_account_editor_check(mav->edit, mail_account_pages[mav->current_page].path))
+ mav_next_pressed (NULL, mav);
+ }
+ }
+}
+
+static void
+mav_prev_pressed (GtkButton *button, MailAccountView *mav)
+{
+ if (mav->current_page == 0)
+ return;
+
+ gtk_widget_hide (mav->pages[mav->current_page]->box);
+ mav->current_page--;
+ if (mav->current_page == MAV_RECV_OPT_PAGE && mav->original == NULL)
+ mav->current_page--; /* Skip recv options in new account creation. */
+ if (mav->current_page == MAV_DEFAULTS_PAGE && mav->original == NULL)
+ mav->current_page--; /* Skip defaults in new account creation. */
+ gtk_widget_show (mav->pages[mav->current_page]->box);
+
+}
+
+
+static GtkWidget *
+mav_construct_page(MailAccountView *view, MAVPageType type)
+{
+ MAVPage *page = g_new0(MAVPage, 1);
+ GtkWidget *box, *tmp, *error_box;
+ char *str;
+
+ page->type = type;
+
+ page->box = gtk_vbox_new (FALSE, 2);
+
+ error_box = gtk_hbox_new (FALSE, 2);
+ page->error_label = gtk_label_new ("");
+ tmp = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start ((GtkBox *)error_box, tmp, FALSE, FALSE, 2);
+ gtk_box_pack_start ((GtkBox *)error_box, page->error_label, FALSE, FALSE, 2);
+ gtk_widget_hide (tmp);
+ gtk_widget_show (page->error_label);
+ page->error = tmp;
+ gtk_widget_show (error_box);
+
+ box = gtk_hbox_new (FALSE, 12);
+ gtk_widget_show(box);
+ gtk_box_pack_start((GtkBox *)page->box, box, FALSE, FALSE, 12);
+ tmp = gtk_label_new (NULL);
+ str = g_strdup_printf("<span size=\"xx-large\" weight=\"heavy\">%s</span>", _(mail_account_pages[type].head));
+ gtk_label_set_markup ((GtkLabel *)tmp, str);
+ g_free(str);
+ gtk_widget_show (tmp);
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 12);
+
+ box = gtk_hbox_new (FALSE, 12);
+ gtk_widget_show(box);
+ gtk_box_pack_start((GtkBox *)page->box, box, FALSE, FALSE, 12);
+ tmp = gtk_label_new (_(mail_account_pages[type].detail));
+ gtk_widget_set_size_request (tmp, 600, -1);
+ gtk_label_set_line_wrap ((GtkLabel *)tmp, TRUE);
+ gtk_label_set_line_wrap_mode ((GtkLabel *)tmp, PANGO_WRAP_WORD);
+ gtk_widget_show(tmp);
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 12);
+
+ page->main = NULL;
+ if (mail_account_pages[type].create_page && mail_account_pages[type].path) {
+ tmp = (*mail_account_pages[type].create_page) (view);
+ gtk_box_pack_start ((GtkBox *)page->box, tmp, FALSE, FALSE, 3);
+ page->main = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (page->main);
+ gtk_box_pack_start((GtkBox *)page->main, tmp, FALSE, FALSE, 0);
+ }
+
+ if (mail_account_pages[type].fill_page) {
+ (*mail_account_pages[type].fill_page) (view);
+ }
+
+ if ((view->original && mail_account_pages[type].prev_edit) || mail_account_pages[type].prev) {
+ box = gtk_hbox_new(FALSE, 0);
+ if (anjal_icon_decoration) {
+ tmp = gtk_image_new_from_icon_name ("go-previous", GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 0);
+ }
+ tmp = gtk_label_new (_(view->original ? mail_account_pages[type].prev_edit : mail_account_pages[type].prev));
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3);
+ page->prev = gtk_button_new ();
+ gtk_container_add ((GtkContainer *)page->prev, box);
+ gtk_widget_show_all(page->prev);
+ g_signal_connect(page->prev, "clicked", G_CALLBACK(mav_prev_pressed), view);
+ }
+
+ if ((view->original && mail_account_pages[type].next_edit) || mail_account_pages[type].next) {
+ box = gtk_hbox_new(FALSE, 0);
+ tmp = gtk_label_new (_(view->original ? mail_account_pages[type].next_edit : mail_account_pages[type].next));
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3);
+ if (anjal_icon_decoration) {
+ tmp = gtk_image_new_from_icon_name ("go-next", GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 0);
+ }
+ page->next = gtk_button_new ();
+ gtk_container_add ((GtkContainer *)page->next, box);
+ gtk_widget_show_all(page->next);
+ g_signal_connect(page->next, "clicked", G_CALLBACK(mav_next_pressed), view);
+ }
+
+ box = gtk_hbox_new (FALSE, 0);
+ if (page->prev)
+ gtk_box_pack_start ((GtkBox *)box, page->prev, FALSE, FALSE, 12);
+ if (page->next)
+ gtk_box_pack_end ((GtkBox *)box, page->next, FALSE, FALSE, 12);
+ gtk_widget_show (box);
+ gtk_box_pack_end ((GtkBox *)page->box, box, FALSE, FALSE, 6);
+ gtk_widget_show(page->box);
+ gtk_box_pack_end ((GtkBox *)page->box, error_box, FALSE, FALSE, 2);
+ return (GtkWidget *)page;
+}
+
+static ServerData *
+emae_check_servers (const gchar *email)
+{
+ ServerData *sdata = g_new0(ServerData, 1);
+ EmailProvider *provider = g_new0(EmailProvider, 1);
+ char *dupe = g_strdup(email);
+ char *tmp;
+
+ /* FIXME: Find a way to free the provider once given to account settings. */
+ provider->email = (char *)email;
+ tmp = strchr(email, '@');
+ tmp++;
+ provider->domain = tmp;
+ tmp = strchr(dupe, '@');
+ *tmp = 0;
+ provider->username = (char *)g_quark_to_string(g_quark_from_string(dupe));
+ g_free(dupe);
+
+ if (!mail_guess_servers (provider)) {
+ g_free (provider);
+ g_free (sdata);
+ return NULL;
+ }
+ /*printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
+ provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth,
+ provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth,
+ provider->recv_socket_type, provider->send_socket_type); */
+
+ sdata->recv = provider->recv_hostname;
+ sdata->recv_port = provider->recv_port;
+ sdata->send = provider->send_hostname;
+ sdata->send_port = provider->send_port;
+ if (strcmp(provider->recv_type, "pop3") == 0)
+ sdata->proto = g_strdup("pop");
+ else
+ sdata->proto = provider->recv_type;
+ if (provider->recv_socket_type) {
+ if(g_ascii_strcasecmp(provider->recv_socket_type, "SSL") == 0)
+ sdata->ssl = g_strdup("always");
+ else if(g_ascii_strcasecmp(provider->recv_socket_type, "secure") == 0)
+ sdata->ssl = g_strdup("always");
+ else if(g_ascii_strcasecmp(provider->recv_socket_type, "STARTTLS") == 0)
+ sdata->ssl = g_strdup("when-possible");
+ else if(g_ascii_strcasecmp(provider->recv_socket_type, "TLS") == 0)
+ sdata->ssl = g_strdup("when-possible");
+ else
+ sdata->ssl = g_strdup("never");
+
+ }
+ sdata->send_user = provider->send_username;
+ sdata->recv_user = provider->recv_username;
+
+
+ g_free (provider);
+
+ return sdata;
+}
+
+void
+mail_account_view_construct (MailAccountView *view)
+{
+ int i;
+
+ view->scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy ((GtkScrolledWindow *)view->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type ((GtkScrolledWindow *)view->scroll, GTK_SHADOW_NONE);
+ view->page_widget = gtk_vbox_new (FALSE, 3);
+ gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *)view->scroll, view->page_widget);
+ gtk_widget_show_all (view->scroll);
+ gtk_widget_set_size_request ((GtkWidget *)view, -1, 300);
+ for (i=0; i<MAV_LAST; i++) {
+ view->pages[i] = (MAVPage *)mav_construct_page (view, i);
+ view->pages[i]->done = FALSE;
+ view->wpages[i] = view->pages[i]->box;
+ gtk_box_pack_start ((GtkBox *)view->page_widget, view->pages[i]->box, TRUE, TRUE, 0);
+ gtk_widget_hide (view->pages[i]->box);
+ }
+ gtk_widget_show (view->pages[0]->box);
+ view->current_page = 0;
+ gtk_box_pack_start ((GtkBox *)view, view->scroll, TRUE, TRUE, 0);
+ view->edit = em_account_editor_new_for_pages (view->original, EMAE_PAGES, "org.gnome.evolution.mail.config.accountWizard", view->wpages);
+ view->edit->emae_check_servers = emae_check_servers;
+ if (!view->original) {
+ e_account_set_bool (em_account_editor_get_modified_account(view->edit), E_ACCOUNT_SOURCE_SAVE_PASSWD, TRUE);
+ e_account_set_bool (em_account_editor_get_modified_account(view->edit), E_ACCOUNT_TRANSPORT_SAVE_PASSWD, TRUE);
+ }
+ em_account_editor_check (view->edit, mail_account_pages[0].path);
+ view->pages[0]->done = TRUE;
+
+}
+
+MailAccountView *
+mail_account_view_new (EAccount *account)
+{
+ MailAccountView *view = g_object_new (MAIL_ACCOUNT_VIEW_TYPE, NULL);
+ view->type = MAIL_VIEW_ACCOUNT;
+ view->uri = "account://";
+ view->original = account;
+ mail_account_view_construct (view);
+
+ return view;
+}
+
+static gboolean
+mav_btn_expose (GtkWidget *w, GdkEventExpose *event, MailAccountView *mfv)
+{
+ GdkPixbuf *img = g_object_get_data ((GObject *)w, "pbuf");
+ cairo_t *cr = gdk_cairo_create (w->window);
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, img, event->area.x-5, event->area.y-4);
+ cairo_paint(cr);
+ cairo_restore(cr);
+ cairo_destroy (cr);
+
+ return TRUE;
+}
+
+static void
+mav_close (GtkButton *w, MailAccountView *mfv)
+{
+ g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
+}
+
+
+
+GtkWidget *
+mail_account_view_get_tab_widget(MailAccountView *mcv)
+{
+ GdkPixbuf *pbuf = gtk_widget_render_icon ((GtkWidget *)mcv, "gtk-close", GTK_ICON_SIZE_MENU, NULL);
+
+ GtkWidget *tool, *box, *img;
+ int w=-1, h=-1;
+ GtkWidget *tab_label;
+
+ img = (GtkWidget *)gtk_image_new_from_pixbuf (pbuf);
+ g_object_set_data ((GObject *)img, "pbuf", pbuf);
+ g_signal_connect (img, "expose-event", G_CALLBACK(mav_btn_expose), mcv);
+
+ tool = gtk_button_new ();
+ gtk_button_set_relief((GtkButton *)tool, GTK_RELIEF_NONE);
+ gtk_button_set_focus_on_click ((GtkButton *)tool, FALSE);
+ gtk_widget_set_tooltip_text (tool, _("Close Tab"));
+ g_signal_connect (tool, "clicked", G_CALLBACK(mav_close), mcv);
+
+ box = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)box, img, FALSE, FALSE, 0);
+ gtk_container_add ((GtkContainer *)tool, box);
+ gtk_widget_show_all (tool);
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings(tool) , GTK_ICON_SIZE_MENU, &w, &h);
+ gtk_widget_set_size_request (tool, w+2, h+2);
+
+ box = gtk_label_new (_("Account Wizard"));
+ tab_label = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)tab_label, box, FALSE, FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)tab_label, tool, FALSE, FALSE, 0);
+ gtk_widget_show_all (tab_label);
+
+ return tab_label;
+
+}
+
+void
+mail_account_view_activate (MailAccountView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act)
+{
+ if (!check_mail || !sort_by)
+ return;
+ //gtk_widget_hide (folder_tree);
+ gtk_widget_set_sensitive (check_mail, TRUE);
+ gtk_widget_set_sensitive (sort_by, FALSE);
+}
diff --git a/capplet/mail-account-view.h b/capplet/mail-account-view.h
new file mode 100644
index 0000000000..5066d83dce
--- /dev/null
+++ b/capplet/mail-account-view.h
@@ -0,0 +1,94 @@
+/*
+ * 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 _MAIL_ACCOUNT_VIEW_H_
+#define _MAIL_ACCOUNT_VIEW_H_
+
+#include <gtk/gtk.h>
+#include "mail/em-account-editor.h"
+#include <libedataserver/e-account-list.h>
+#include <camel/camel-provider.h>
+#include "mail-view.h"
+
+#define MAIL_ACCOUNT_VIEW_TYPE (mail_account_view_get_type ())
+#define MAIL_ACCOUNT_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_ACCOUNT_VIEW_TYPE, MailFolderView))
+#define MAIL_ACCOUNT_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MAIL_ACCOUNT_VIEW_TYPE, MailFolderViewClass))
+#define IS_MAIL_ACCOUNT_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_ACCOUNT_VIEW_TYPE))
+#define IS_MAIL_ACCOUNT_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_VIEW_TYPE))
+#define MAIL_ACCOUNT_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MAIL_ACCOUNT_VIEW_TYPE, MailFolderViewClass))
+
+typedef struct _MailAccountViewPrivate MailAccountViewPrivate;
+typedef struct _MailAccountService MailAccountService;
+
+typedef enum {
+ MAV_IDENTITY_PAGE=0,
+ MAV_RECV_PAGE,
+ MAV_RECV_OPT_PAGE,
+ MAV_SEND_PAGE,
+ MAV_DEFAULTS_PAGE,
+ MAV_REVIEW_PAGE,
+ MAV_LAST,
+} MAVPageType;
+
+typedef struct _MAVPage {
+ GtkWidget *box;
+ GtkWidget *main;
+ GtkWidget *error;
+ GtkWidget *error_label;
+ MAVPageType type;
+ GtkWidget *next;
+ GtkWidget *prev;
+ gboolean done;
+}MAVPage;
+
+
+
+typedef struct _MailAccountView {
+ GtkVBox parent;
+ int type;
+ char *uri;
+ MailViewFlags flags;
+ /* Base class of MailChildView ends */
+
+ GtkWidget *scroll;
+ GtkWidget *page_widget;
+
+ MAVPage *pages[6];
+ struct _EAccount *original;
+ GtkWidget *wpages[6];
+ int current_page;
+ struct _EMAccountEditor *edit;
+
+ MailAccountViewPrivate *priv;
+} MailAccountView;
+
+typedef struct _MailAccountViewClass {
+ GtkVBoxClass parent_class;
+
+ void (* view_close) (MailAccountView *);
+
+} MailAccountViewClass;
+
+MailAccountView *mail_account_view_new (EAccount *account);
+GtkWidget * mail_account_view_get_tab_widget(MailAccountView *mcv);
+void mail_account_view_activate (MailAccountView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act);
+#endif
diff --git a/capplet/mail-capplet-shell.c b/capplet/mail-capplet-shell.c
new file mode 100644
index 0000000000..7da60bde7c
--- /dev/null
+++ b/capplet/mail-capplet-shell.c
@@ -0,0 +1,464 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * 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@gnome.org>
+ * Srinivasa Ragavan <srini@linux.intel.com>
+ *
+ * Copyright (C) 2010 Intel Corporation. (www.intel.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gconf/gconf-client.h>
+#include "mail-capplet-shell.h"
+#include "mail-view.h"
+#include <gdk/gdkkeysyms.h>
+
+#include <e-util/e-util.h>
+
+#include "mail-decoration.h"
+#include <mail/em-utils.h>
+#include <mail/em-composer-utils.h>
+enum {
+ CTRL_W_PRESSED,
+ CTRL_Q_PRESSED,
+ LAST_SIGNAL
+};
+
+/* Re usable colors */
+
+GdkColor *pcolor_sel;
+char *scolor_sel;
+GdkColor *pcolor_fg_sel;
+char *scolor_fg_sel;
+GdkColor *pcolor_bg_norm;
+char *scolor_bg_norm;
+GdkColor *pcolor_norm;
+char *scolor_norm;
+GdkColor *pcolor_fg_norm;
+char *scolor_fg_norm;
+
+static guint mail_capplet_shell_signals[LAST_SIGNAL];
+
+extern gboolean windowed;
+
+struct _MailCappletShellPrivate {
+
+ GtkWidget *box;
+
+ GtkWidget * top_bar;
+ GtkWidget *message_pane;
+ GtkWidget *bottom_bar;
+
+ /* Top Bar */
+ GtkWidget *action_bar;
+ GtkWidget *quit;
+
+ MailViewChild *settings_view;
+};
+
+static void mail_capplet_shell_quit (MailCappletShell *shell);
+
+G_DEFINE_TYPE (MailCappletShell, mail_capplet_shell, GTK_TYPE_WINDOW)
+
+static void setup_abooks (void);
+
+static void
+mail_capplet_shell_init (MailCappletShell *shell)
+{
+ shell->priv = g_new0(MailCappletShellPrivate, 1);
+ shell->priv->settings_view = NULL;
+}
+
+static void
+mail_capplet_shell_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (mail_capplet_shell_parent_class)->finalize (object);
+}
+
+static void
+ms_ctrl_w_pressed (MailCappletShell *shell)
+{
+ MailCappletShellPrivate *priv = shell->priv;
+
+ mail_view_close_view ((MailView *)shell->view);
+}
+
+static void
+ms_ctrl_q_pressed (MailCappletShell *shell)
+{
+ mail_capplet_shell_quit (shell);
+}
+
+static void
+mail_capplet_shell_class_init (MailCappletShellClass *klass)
+{
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ GtkBindingSet *binding_set;
+
+ mail_capplet_shell_parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = mail_capplet_shell_finalize;
+ klass->ctrl_w_pressed = ms_ctrl_w_pressed;
+ klass->ctrl_q_pressed = ms_ctrl_q_pressed;
+
+ mail_capplet_shell_signals [CTRL_W_PRESSED] =
+ g_signal_new ("ctrl_w_pressed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MailCappletShellClass, ctrl_w_pressed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ mail_capplet_shell_signals [CTRL_Q_PRESSED] =
+ g_signal_new ("ctrl_q_pressed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MailCappletShellClass, ctrl_q_pressed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_W, GDK_CONTROL_MASK, "ctrl_w_pressed", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_w, GDK_CONTROL_MASK, "ctrl_w_pressed", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_Q, GDK_CONTROL_MASK, "ctrl_q_pressed", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_Q, GDK_CONTROL_MASK, "ctrl_q_pressed", 0);
+
+};
+
+static int
+color_expose (GtkWidget *w,
+ GdkEventExpose *event G_GNUC_UNUSED,
+ gpointer data)
+{
+ GtkWindow *win = (GtkWindow *)data;
+ cairo_t *cr = gdk_cairo_create (w->window);
+ int wid = w->allocation.width;
+ int heig = w->allocation.height;
+ int wwid, wheig;
+ GdkColor paint;
+
+ gtk_window_get_size (win, &wwid, &wheig);
+ gdk_color_parse ("#000000", &paint);
+ gdk_cairo_set_source_color (cr, &(paint));
+ cairo_rectangle (cr, 0, 0, wwid, wheig);
+ cairo_stroke (cr);
+
+ gdk_color_parse ("#000000", &paint);
+ gdk_cairo_set_source_color (cr, &(paint));
+ cairo_rectangle (cr, 1, 1, wid, heig);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+
+ return FALSE;
+}
+
+
+
+static void
+ms_init_style (GtkStyle *style)
+{
+ pcolor_sel = &style->base[GTK_STATE_SELECTED];
+ scolor_sel = gdk_color_to_string (pcolor_sel);
+
+ pcolor_norm = &style->bg[GTK_STATE_NORMAL];
+ scolor_norm = gdk_color_to_string (pcolor_norm);
+
+ pcolor_bg_norm = &style->base[GTK_STATE_NORMAL];
+ scolor_bg_norm = gdk_color_to_string (pcolor_bg_norm);
+
+ pcolor_fg_sel =&style->fg[GTK_STATE_SELECTED];
+ scolor_fg_sel = gdk_color_to_string (pcolor_fg_sel);
+
+ pcolor_fg_norm =&style->fg[GTK_STATE_NORMAL];
+ scolor_fg_norm = gdk_color_to_string (pcolor_fg_norm);
+}
+
+static void
+mail_capplet_shell_quit (MailCappletShell *shell)
+{
+ gtk_main_quit();
+}
+
+static void
+mail_capplet_shell_quit_cb (GtkWidget *w G_GNUC_UNUSED,
+ MailCappletShell *shell)
+{
+ mail_capplet_shell_quit (shell);
+}
+
+static void
+ms_delete_event (MailCappletShell *shell,
+ GdkEvent *event G_GNUC_UNUSED,
+ gpointer data G_GNUC_UNUSED)
+{
+ mail_capplet_shell_quit (shell);
+}
+
+static gboolean
+ms_check_new ()
+{
+ GConfClient *client;
+ GSList *accounts;
+
+ client = gconf_client_get_default ();
+ accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
+ g_object_unref (client);
+
+ if (accounts != NULL) {
+ g_slist_foreach (accounts, (GFunc) g_free, NULL);
+ g_slist_free (accounts);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static void
+ms_show_post_druid (MailViewChild *mfv G_GNUC_UNUSED,
+ MailCappletShell *shell)
+{
+ if (shell->priv->settings_view)
+ mail_view_switch_to_settings ((MailView *)shell->view, (MailViewChild *)shell->priv->settings_view);
+ else {
+ shell->priv->settings_view = mail_view_add_page ((MailView *)shell->view, MAIL_VIEW_SETTINGS, NULL);
+ }
+
+}
+
+#define PACK_IN_TOOL(wid,icon) { GtkWidget *tbox; tbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)tbox, gtk_image_new_from_icon_name(icon, GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0); wid = (GtkWidget *)gtk_tool_button_new (tbox, NULL); }
+
+#if 0
+static void
+handle_cmdline (MailView *mv, MailCappletShell *shell)
+{
+ g_signal_handlers_block_by_func (mv, handle_cmdline, shell);
+ mail_capplet_shell_handle_cmdline (shell);
+}
+#endif
+
+void
+mail_capplet_shell_construct (MailCappletShell *shell, int socket_id)
+{
+ MailCappletShellPrivate *priv = shell->priv;
+ GtkWidget *tmp, *img, *box, *ar1, *ar2, *lbl;
+ GtkStyle *style = gtk_widget_get_default_style ();
+ int window_width = 1024;
+ char *custom_dir;
+
+ gtk_window_set_icon_name ((GtkWindow *)shell, "evolution");
+ ms_init_style (style);
+ g_signal_connect ((GObject *)shell, "delete-event", G_CALLBACK (ms_delete_event), NULL);
+ gtk_window_set_type_hint ((GtkWindow *)shell, GDK_WINDOW_TYPE_HINT_NORMAL);
+ if (g_getenv("ANJAL_NO_MAX") == NULL && !windowed) {
+ GdkScreen *scr = gtk_widget_get_screen ((GtkWidget *)shell);
+ window_width = gdk_screen_get_width(scr);
+ gtk_window_set_default_size ((GtkWindow *)shell, gdk_screen_get_width(scr), gdk_screen_get_height (scr));
+ gtk_window_set_decorated ((GtkWindow *)shell, FALSE);
+ } else {
+ mail_decoration_new ((GtkWindow *)shell);
+ }
+
+
+ priv->box = (GtkWidget *) gtk_vbox_new (FALSE, 0);
+ gtk_widget_show ((GtkWidget *)priv->box);
+
+ if (!socket_id) {
+ /* Toolbar */
+ priv->top_bar = gtk_toolbar_new ();
+ gtk_box_pack_start ((GtkBox *)priv->box, priv->top_bar, FALSE, FALSE, 0);
+ gtk_widget_show (priv->top_bar);
+ if (g_getenv("ANJAL_NO_MAX") || windowed) {
+ gtk_container_set_border_width (GTK_CONTAINER (shell), 1);
+ g_signal_connect (priv->top_bar, "expose-event",
+ G_CALLBACK (color_expose),
+ shell);
+ /* Leave it to the theme to decide the height */
+ /* gtk_widget_set_size_request (priv->top_bar, -1, 42); */
+ }
+
+ /* Label */
+ tmp = (GtkWidget *)gtk_tool_item_new ();
+ gtk_tool_item_set_expand((GtkToolItem *)tmp, FALSE);
+ lbl = gtk_label_new (_("Email Settings"));
+ gtk_container_add ((GtkContainer *)tmp, lbl);
+ gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)tmp, 0);
+ gtk_widget_show_all (tmp);
+
+ tmp = (GtkWidget *)gtk_tool_item_new ();
+ gtk_tool_item_set_expand((GtkToolItem *)tmp, TRUE);
+ lbl = gtk_label_new (NULL);
+ gtk_container_add ((GtkContainer *)tmp, lbl);
+ gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)tmp, 1);
+ gtk_widget_show_all (tmp);
+
+ /* Close button */
+ PACK_IN_TOOL(priv->quit, "gtk-close");
+ gtk_widget_set_tooltip_text(priv->quit, _("Quit"));
+ gtk_tool_item_set_expand ((GtkToolItem *)priv->quit, FALSE);
+ gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)priv->quit, -1);
+ gtk_widget_show_all (priv->quit);
+ g_signal_connect (priv->quit, "clicked", G_CALLBACK(mail_capplet_shell_quit_cb), shell);
+
+ gtk_container_add ((GtkContainer *)shell, priv->box);
+ } else {
+ GtkWidget *plug = gtk_plug_new (socket_id);
+
+ gtk_container_add ((GtkContainer *)plug, priv->box);
+ g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ gtk_widget_show (plug);
+ gtk_widget_hide ((GtkWidget *)shell);
+
+ }
+
+ shell->view = mail_view_new ();
+ gtk_widget_show ((GtkWidget *)shell->view);
+ tmp = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_end ((GtkBox *)priv->box, (GtkWidget *)shell->view, TRUE, TRUE, 2);
+
+ /* This also initializes Camel, so it needs to happen early. */
+ mail_session_init ();
+ mail_config_init ();
+ mail_msg_init ();
+ custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+ e_mail_store_init (custom_dir);
+ g_free (custom_dir);
+
+ if (ms_check_new()) {
+ MailViewChild *mc;
+ char *pdir = g_build_filename (g_get_home_dir(), ".gnome2_private", NULL);
+
+ mc = mail_view_add_page ((MailView *)shell->view, MAIL_VIEW_ACCOUNT, NULL);
+ g_signal_connect (mc, "view-close", G_CALLBACK(ms_show_post_druid), shell);
+ setup_abooks ();
+ if (!g_file_test(pdir, G_FILE_TEST_EXISTS)) {
+ g_mkdir (pdir, 0700);
+ }
+ g_free (pdir);
+ } else
+ shell->priv->settings_view = mail_view_add_page ((MailView *)shell->view, MAIL_VIEW_SETTINGS, NULL);
+
+
+}
+
+int
+mail_capplet_shell_toolbar_height (MailCappletShell *shell)
+{
+ return shell->priv->top_bar->allocation.height;
+}
+
+MailCappletShell *
+mail_capplet_shell_new (int socket_id)
+{
+ MailCappletShell *shell = g_object_new (MAIL_CAPPLET_SHELL_TYPE, NULL);
+ mail_capplet_shell_construct (shell, socket_id);
+
+ return shell;
+}
+
+#define PERSONAL_RELATIVE_URI "system"
+
+static void
+setup_abooks()
+{
+ char *base_dir, *uri;
+ GSList *groups;
+ ESourceGroup *group;
+ ESourceList *list = NULL;
+ ESourceGroup *on_this_computer = NULL;
+ ESource *personal_source = NULL;
+
+ base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", "local", NULL);
+ uri = g_filename_to_uri (base_dir, NULL, NULL);
+
+ if (!e_book_get_addressbooks(&list, NULL)) {
+ g_warning ("Unable to get books\n");
+ return;
+ }
+
+ groups = e_source_list_peek_groups (list);
+ if (groups) {
+ /* groups are already there, we need to search for things... */
+ GSList *g;
+
+ for (g = groups; g; g = g->next) {
+
+ group = E_SOURCE_GROUP (g->data);
+
+ if (!on_this_computer && !strcmp (uri, e_source_group_peek_base_uri (group))) {
+ on_this_computer = g_object_ref (group);
+ break;
+ }
+ }
+ }
+
+ if (on_this_computer) {
+ /* make sure "Personal" shows up as a source under
+ this group */
+ GSList *sources = e_source_group_peek_sources (on_this_computer);
+ GSList *s;
+ for (s = sources; s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+ if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
+ personal_source = g_object_ref (source);
+ break;
+ }
+ }
+ }
+ else {
+ /* create the local source group */
+ group = e_source_group_new (_("On This Computer"), uri);
+ e_source_list_add_group (list, group, -1);
+
+ on_this_computer = group;
+ }
+
+ if (!personal_source) {
+ /* Create the default Person addressbook */
+ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, source, -1);
+
+ e_source_set_property (source, "completion", "true");
+
+ personal_source = source;
+ }
+
+ if (on_this_computer)
+ g_object_unref (on_this_computer);
+ if (personal_source)
+ g_object_unref (personal_source);
+
+ e_source_list_sync (list, NULL);
+ g_object_unref (list);
+ g_free (uri);
+ g_free (base_dir);
+}
+
diff --git a/capplet/mail-capplet-shell.h b/capplet/mail-capplet-shell.h
new file mode 100644
index 0000000000..be6ba2571c
--- /dev/null
+++ b/capplet/mail-capplet-shell.h
@@ -0,0 +1,58 @@
+/*
+ * 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@gnome.org>
+ * Srinivasa Ragavan <srini@linux.intel.com>
+ *
+ * Copyright (C) 2010 Intel Corporation. (www.intel.com)
+ *
+ */
+
+#ifndef _MAIL_CAPPLET_SHELL_H_
+#define _MAIL_CAPPLET_SHELL_H_
+
+#include <gtk/gtk.h>
+#include "mail-view.h"
+
+#define MAIL_CAPPLET_SHELL_TYPE (mail_capplet_shell_get_type ())
+#define MAIL_CAPPLET_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_CAPPLET_SHELL_TYPE, MailCappletShell))
+#define MAIL_CAPPLET_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MAIL_CAPPLET_SHELL_TYPE, MailCappletShellClass))
+#define IS_MAIL_CAPPLET_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_CAPPLET_SHELL_TYPE))
+#define IS_MAIL_CAPPLET_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_CAPPLET_SHELL_TYPE))
+#define MAIL_CAPPLET_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MAIL_CAPPLET_SHELL_TYPE, MailCappletShellClass))
+
+typedef struct _MailCappletShellPrivate MailCappletShellPrivate;
+
+typedef struct _MailCappletShell {
+ GtkWindow parent;
+ MailView *view;
+
+ MailCappletShellPrivate *priv;
+} MailCappletShell;
+
+typedef struct _MailCappletShellClass {
+ GtkWindowClass parent_class;
+
+ void (* ctrl_w_pressed) (MailCappletShell *class);
+ void (* ctrl_q_pressed) (MailCappletShell *class);
+} MailCappletShellClass;
+
+MailCappletShell * mail_capplet_shell_new (int socket_id);
+int mail_capplet_shell_toolbar_height (MailCappletShell *shell);
+
+#endif
+
+
diff --git a/capplet/mail-decoration.c b/capplet/mail-decoration.c
new file mode 100644
index 0000000000..689bb83285
--- /dev/null
+++ b/capplet/mail-decoration.c
@@ -0,0 +1,354 @@
+/*
+ * 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)
+ *
+ */
+
+/* Many thanks to Aaron Bockover & Cubano. This is just a C version Cubano's self decoration */
+
+#include "mail-decoration.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <gconf/gconf-client.h>
+
+#define MAIL_DECORATION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MAIL_DECORATION_TYPE, MailDecorationPrivate))
+
+struct _MailDecorationPrivate
+{
+ GdkCursor *cursors[8];
+ gboolean default_cursor;
+ gboolean resizing;
+ GdkWindowEdge last_edge;
+ int resize_width;
+ int top_height;
+ gboolean check_window;
+ gboolean can_resize;
+ gboolean full_screen;
+
+ int window_width;
+ int window_height;
+};
+
+static GObjectClass *parent_class = NULL;
+
+static void mail_decoration_class_init(MailDecorationClass *klass);
+static void mail_decoration_init(MailDecoration *facet);
+
+GType
+mail_decoration_get_type(void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GTypeInfo mail_decoration_info =
+ {
+ sizeof (MailDecorationClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) mail_decoration_class_init,
+ NULL,
+ NULL,
+ sizeof (MailDecoration),
+ 0,
+ (GInstanceInitFunc) mail_decoration_init
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "MailDecoration",
+ &mail_decoration_info, 0);
+ }
+
+ return type;
+}
+
+static void
+md_translate_position (GdkWindow *w, double ex, double ey, int *x, int *y, GtkWidget *window)
+{
+ *x = (int)ex;
+ *y = (int)ey;
+
+ while (w && w != window->window) {
+ int cx, cy, cw, ch, cd;
+ gdk_window_get_geometry (w, &cx, &cy, &cw, &ch, &cd);
+ *x += cx;
+ *y += cy;
+ w = (GdkWindow *)((GdkWindowObject *)w)->parent;
+ }
+}
+
+static gboolean
+in_top (MailDecoration *md, double y)
+{
+ return y <= md->priv->resize_width;
+}
+
+static gboolean
+in_left (MailDecoration *md, double x)
+{
+ return x <= md->priv->resize_width;
+}
+
+static gboolean
+in_bottom (MailDecoration *md, double y)
+{
+ return y >= ((GtkWidget *)md->window)->allocation.height - md->priv->resize_width;
+}
+
+static gboolean
+in_right (MailDecoration *md, double x)
+{
+ return x >= ((GtkWidget *)md->window)->allocation.width - md->priv->resize_width;
+}
+
+
+static void
+set_cursor (MailDecoration *md, GdkWindowEdge edge)
+{
+ gdk_window_set_cursor (((GtkWidget *)md->window)->window, md->priv->cursors[edge]);
+ md->priv->default_cursor = FALSE;
+}
+
+static void
+reset_cursor (MailDecoration *md)
+{
+ if (!md->priv->default_cursor) {
+ md->priv->default_cursor = TRUE;
+ gdk_window_set_cursor (((GtkWidget *)md->window)->window, NULL);
+ }
+
+}
+
+static void
+update_cursor (MailDecoration *md, double x, double y, gboolean update)
+{
+ if (update)
+ md->priv->resizing = TRUE;
+
+ if (in_top(md, y) && in_left (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_NORTH_WEST;
+ set_cursor (md, GDK_WINDOW_EDGE_NORTH_WEST);
+ } else if (in_top (md, y) && in_right (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_NORTH_EAST;
+ set_cursor (md, GDK_WINDOW_EDGE_NORTH_EAST);
+ } else if (in_bottom (md, y) && in_left (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_SOUTH_WEST;
+ set_cursor (md, GDK_WINDOW_EDGE_SOUTH_WEST);
+ } else if (in_bottom (md, y) && in_right (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_SOUTH_EAST;
+ set_cursor (md, GDK_WINDOW_EDGE_SOUTH_EAST);
+ } else if (in_top (md, y)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_NORTH;
+ set_cursor (md, GDK_WINDOW_EDGE_NORTH);
+ } else if (in_bottom (md, y)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_SOUTH;
+ set_cursor (md, GDK_WINDOW_EDGE_SOUTH);
+ } else if (in_left (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_WEST;
+ set_cursor (md, GDK_WINDOW_EDGE_WEST);
+ } else if (in_right (md, x)) {
+ md->priv->last_edge = GDK_WINDOW_EDGE_EAST;
+ set_cursor (md, GDK_WINDOW_EDGE_EAST);
+ } else {
+ if (update)
+ md->priv->resizing = FALSE;
+ reset_cursor (md);
+ }
+}
+
+
+static gboolean
+md_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
+{
+ int x, y;
+ MailDecoration *md = (MailDecoration *)user_data;
+
+ md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
+
+ if (md->priv->can_resize) {
+ update_cursor (md, x, y, FALSE);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+md_enter_event (GtkWidget *widget , GdkEventCrossing *event, gpointer user_data)
+{
+ MailDecoration *md = (MailDecoration *)user_data;
+ int x, y;
+
+ md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
+
+ if (md->priv->can_resize) {
+ update_cursor (md, x, y, FALSE);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+md_leave_event (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
+{
+ MailDecoration *md = (MailDecoration *)user_data;
+
+ if (md->priv->can_resize)
+ reset_cursor (md);
+
+ return FALSE;
+}
+
+static void
+md_size_allocate_event (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
+{
+ int width=1024, height=500;
+ MailDecoration *md = (MailDecoration *)user_data;
+
+ gtk_widget_queue_draw (widget);
+ gtk_window_get_size ((GtkWindow *)widget, &width, &height);
+ if (width != md->priv->window_width || height != md->priv->window_height) {
+ GConfClient *client = gconf_client_get_default ();
+
+ md->priv->window_height = height;
+ md->priv->window_width = width;
+ gconf_client_set_int (client, "/apps/anjal/window_width", width, NULL);
+ gconf_client_set_int (client, "/apps/anjal/window_height", height, NULL);
+ g_object_unref(client);
+ }
+
+}
+
+static gboolean
+md_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+{
+ MailDecoration *md = (MailDecoration *)user_data;
+ int x_root = (int) event->x_root;
+ int y_root = (int) event->y_root;
+ int x, y;
+
+ if (!md->priv->can_resize) {
+ return FALSE;
+ }
+
+ md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
+ update_cursor (md, x, y, TRUE);
+ if (md->priv->resizing && event->button == 1 && event->type != GDK_2BUTTON_PRESS) {
+ gtk_window_begin_resize_drag ((GtkWindow *)widget, md->priv->last_edge, 1, x_root, y_root, event->time);
+
+ } else if ((md->priv->resizing && event->button == 2 && event->type != GDK_2BUTTON_PRESS) ||
+ (event->button == 1 && y <= md->priv->top_height && event->type != GDK_2BUTTON_PRESS)) {
+ gtk_window_begin_move_drag ((GtkWindow *)widget, event->button, x_root, y_root, event->time);
+ } else if (y <= md->priv->top_height && event->type == GDK_2BUTTON_PRESS) {
+ if (md->priv->full_screen)
+ gtk_window_unfullscreen (md->window);
+ else
+ gtk_window_fullscreen (md->window);
+
+ md->priv->full_screen = md->priv->full_screen != TRUE;
+ } else
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+md_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+{
+ int x, y;
+ MailDecoration *md = (MailDecoration *)user_data;
+
+ md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
+ if (md->priv->resizing) {
+ update_cursor (md, x, y, TRUE);
+ }
+
+ return FALSE;
+}
+
+MailDecoration* mail_decoration_new(GtkWindow *window)
+{
+ MailDecoration *md = g_object_new(mail_decoration_get_type(), NULL);
+ GConfClient *client = gconf_client_get_default ();
+ int width, height;
+
+ md->priv->window_width = width = gconf_client_get_int (client, "/apps/anjal/window_width", NULL);
+ if (!width)
+ md->priv->window_width = width = 1024;
+ md->priv->window_height = height = gconf_client_get_int (client, "/apps/anjal/window_height", NULL);
+ if (!height)
+ md->priv->window_height = height = 500;
+ g_object_unref (client);
+
+ md->window = window;
+ gtk_window_set_decorated (window, FALSE);
+ gtk_widget_add_events ((GtkWidget *)window, GDK_BUTTON_PRESS_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK |
+ GDK_BUTTON_RELEASE_MASK);
+
+ g_signal_connect (window, "motion-notify-event", G_CALLBACK(md_motion_event), md);
+ g_signal_connect (window, "enter-notify-event", G_CALLBACK(md_enter_event), md);
+ g_signal_connect (window, "leave-notify-event", G_CALLBACK(md_leave_event), md);
+ g_signal_connect (window, "button-press-event", G_CALLBACK(md_button_press_event), md);
+ g_signal_connect (window, "button-release-event", G_CALLBACK(md_button_release_event), md);
+ g_signal_connect (window, "size-allocate", G_CALLBACK(md_size_allocate_event), md);
+ gtk_window_set_default_size ((GtkWindow *)window , width, height);/* We officiall should support 800x600 */
+
+ return md;
+}
+
+
+static void
+mail_decoration_class_init(MailDecorationClass *klass)
+{
+
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ parent_class = g_type_class_peek_parent (klass);
+
+ g_type_class_add_private (object_class, sizeof(MailDecorationPrivate));
+}
+
+static void
+mail_decoration_init(MailDecoration *md)
+{
+ MailDecorationPrivate *priv;
+
+ priv = MAIL_DECORATION_GET_PRIVATE (md);
+ md->priv = priv;
+
+ priv->cursors[0]= gdk_cursor_new (GDK_TOP_LEFT_CORNER);
+ priv->cursors[1]= gdk_cursor_new (GDK_TOP_SIDE);
+ priv->cursors[2]= gdk_cursor_new (GDK_TOP_RIGHT_CORNER);
+ priv->cursors[3]= gdk_cursor_new (GDK_LEFT_SIDE);
+ priv->cursors[4]= gdk_cursor_new (GDK_RIGHT_SIDE);
+ priv->cursors[5]= gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER);
+ priv->cursors[6]= gdk_cursor_new (GDK_BOTTOM_SIDE);
+ priv->cursors[7]= gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER);
+
+ priv->default_cursor = TRUE;
+ priv->resizing = FALSE;
+ priv->resize_width = 4;
+ priv->top_height = 54;
+ priv->check_window = TRUE;
+ priv->can_resize = TRUE;
+ priv->full_screen = TRUE;
+}
diff --git a/capplet/mail-decoration.h b/capplet/mail-decoration.h
new file mode 100644
index 0000000000..9010e8990c
--- /dev/null
+++ b/capplet/mail-decoration.h
@@ -0,0 +1,69 @@
+/*
+ * 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
+
+#ifndef _MAIL_DECORATION_
+#define _MAIL_DECORATION_
+
+#include <gtk/gtk.h>
+
+
+#define MAIL_DECORATION_TYPE \
+ (mail_decoration_get_type ())
+#define MAIL_DECORATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), MAIL_DECORATION_TYPE, MailDecoration))
+#define MAIL_DECORATION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), MAIL_DECORATION_TYPE, MailDecorationClass))
+#define IS_MAIL_DECORATION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), MAIL_DECORATION_TYPE))
+#define IS_MAIL_DECORATION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), MAIL_DECORATION_TYPE))
+#define MAIL_DECORATION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), MAIL_DECORATION_TYPE, MailDecorationClass))
+
+typedef struct _MailDecoration MailDecoration;
+typedef struct _MailDecorationClass MailDecorationClass;
+typedef struct _MailDecorationPrivate MailDecorationPrivate;
+
+struct _MailDecoration {
+ GObject parent;
+
+ GtkWindow *window;
+ MailDecorationPrivate *priv;
+};
+
+struct _MailDecorationClass {
+ GObjectClass parent_class;
+};
+
+MailDecoration *mail_decoration_new(GtkWindow *);
+
+
+#endif
diff --git a/capplet/mail-guess-servers.c b/capplet/mail-guess-servers.c
new file mode 100644
index 0000000000..26fc630f16
--- /dev/null
+++ b/capplet/mail-guess-servers.c
@@ -0,0 +1,274 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * 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 <srini@linux.intel.com>
+ *
+ * Copyright (C) 2009 Intel Corporation (www.intel.com)
+ *
+ */
+
+/* Template of the code is taken from libsoup tests/ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <libsoup/soup.h>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlmemory.h>
+
+#include "mail-guess-servers.h"
+
+static char *
+xml_to_gchar (xmlChar *xml, EmailProvider *provider)
+{
+ char *gxml = NULL;
+ char *tmp;
+ char *repl = NULL, *sec_part;
+
+ tmp = xml ? strstr(xml, "\%EMAIL") : NULL;
+
+ if (!tmp) {
+ gxml = xml ? g_strdup(xml) : NULL ;
+ } else {
+ decodepart:
+ *tmp = 0;
+ tmp+=6;
+ if(*tmp == 'A')
+ repl = provider->email;
+ else if (*tmp == 'L')
+ repl = provider->username;
+ else if (*tmp == 'D')
+ repl = provider->domain;
+ sec_part = strstr(tmp, "\%");
+ sec_part++;
+ if (!*sec_part)
+ sec_part = "";
+
+ gxml = g_strdup_printf("%s%s%s", gxml ? gxml: xml, repl, sec_part);
+ tmp = strstr (gxml, "\%EMAIL");
+ if(tmp) {
+ goto decodepart;
+ }
+ }
+
+ xmlFree(xml);
+
+ return gxml;
+}
+
+static SoupMessage *
+get_url (SoupSession *session, const char *url)
+{
+ const char *name;
+ SoupMessage *msg;
+ const char *header;
+
+ msg = soup_message_new (SOUP_METHOD_GET, url);
+ soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
+
+ soup_session_send_message (session, msg);
+
+ name = soup_message_get_uri (msg)->path;
+
+
+ if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
+ header = soup_message_headers_get_one (msg->response_headers,
+ "Location");
+ if (header) {
+ return get_url (session, header);
+ }
+ } else if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
+ return msg;
+ }
+
+ return NULL;
+}
+
+
+static void
+handle_incoming (xmlNodePtr head, EmailProvider *provider)
+{
+ xmlNodePtr node = head->children;
+
+ provider->recv_type = xml_to_gchar(xmlGetProp(head, "type"), provider);
+
+ while (node) {
+ if (strcmp ((gchar *)node->name, "hostname") == 0) {
+ provider->recv_hostname = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "port") == 0) {
+ provider->recv_port = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "socketType") == 0) {
+ provider->recv_socket_type = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "username") == 0) {
+ provider->recv_username = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "authentication") == 0) {
+ provider->recv_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
+ }
+
+ node = node->next;
+ }
+}
+
+static void
+handle_outgoing (xmlNodePtr head, EmailProvider *provider)
+{
+ xmlNodePtr node = head->children;
+
+ provider->send_type = xml_to_gchar(xmlGetProp(head, "type"), provider);
+
+ while (node) {
+ if (strcmp ((gchar *)node->name, "hostname") == 0) {
+ provider->send_hostname = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "port") == 0) {
+ provider->send_port = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "socketType") == 0) {
+ provider->send_socket_type = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "username") == 0) {
+ provider->send_username = xml_to_gchar(xmlNodeGetContent(node), provider);
+ } else if (strcmp ((gchar *)node->name, "authentication") == 0) {
+ provider->send_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
+ }
+
+ node = node->next;
+ }
+}
+
+static void
+parse_msg (SoupMessage *msg, EmailProvider *provider)
+{
+ xmlDocPtr doc;
+ xmlNodePtr node, top;
+
+ doc = xmlReadMemory ((xmlChar *) msg->response_body->data, msg->response_body->length, "file.xml", NULL, 0);
+
+ node = doc->children;
+ while (node) {
+ if (strcmp ((gchar *)node->name, "clientConfig") == 0) {
+ break;
+ }
+ node = node->next;
+ }
+
+ if (!node) {
+ g_warning ("Incorrect data: ClientConfig not found ... Quitting\n");
+ return;
+ }
+
+ node = node->children;
+ while (node) {
+ if (strcmp ((gchar *)node->name, "emailProvider") == 0) {
+ break;
+ }
+ node = node->next;
+ }
+
+ if (!node) {
+ g_warning ("Incorrect data: ClientConfig not found ... Quitting\n");
+ return;
+ }
+
+ top = node;
+ node = node->children;
+ while (node) {
+ if (strcmp ((gchar *)node->name, "incomingServer") == 0) {
+ /* Handle Incoming */
+ handle_incoming (node, provider);
+ } else if (strcmp ((gchar *)node->name, "outgoingServer") == 0) {
+ /* Handle Outgoing */
+ handle_outgoing (node, provider);
+ }
+
+ node = node->next;
+ }
+
+ xmlFreeDoc(doc);
+}
+
+gboolean
+mail_guess_servers(EmailProvider *provider)
+{
+ const char *cafile = NULL, *url;
+ SoupURI *proxy = NULL, *parsed;
+ int opt;
+ SoupMessage *msg;
+ SoupSession *session;
+
+ url = g_strdup_printf("%s/%s", "https://live.mozillamessaging.com/autoconfig", provider->domain);
+ parsed = soup_uri_new (url);
+ soup_uri_free (parsed);
+
+
+ session = soup_session_sync_new_with_options (
+ SOUP_SESSION_SSL_CA_FILE, cafile,
+ SOUP_SESSION_USER_AGENT, "get ",
+ NULL);
+
+ if (proxy) {
+ g_object_set (G_OBJECT (session),
+ SOUP_SESSION_PROXY_URI, proxy,
+ NULL);
+ }
+
+ msg = get_url (session, url);
+ if (!msg)
+ return FALSE;
+
+ parse_msg(msg, provider);
+
+ g_object_unref (msg);
+ g_object_unref(session);
+ g_free(url);
+
+ return TRUE;
+
+}
+
+#ifdef TEST
+int
+main (int argc, char **argv)
+{
+ EmailProvider *provider;
+ g_thread_init (NULL);
+ g_type_init ();
+
+ provider = g_new0(EmailProvider, 1);
+
+ provider->email = "sragavan@iijmio-mail.jp";
+ provider->domain = "iijmio-mail.jp";
+ provider->username = "sragavan";
+
+ mail_guess_servers (provider);
+
+ printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
+ provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth,
+ provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth,
+ provider->recv_socket_type, provider->send_socket_type);
+ return 0;
+}
+#endif
diff --git a/capplet/mail-guess-servers.h b/capplet/mail-guess-servers.h
new file mode 100644
index 0000000000..b1d6746a4d
--- /dev/null
+++ b/capplet/mail-guess-servers.h
@@ -0,0 +1,51 @@
+/*
+ * 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 <srini@linux.intel.com>
+ *
+ * Copyright (C) 2009 Intel Corporation (www.intel.com)
+ *
+ */
+
+#ifndef _MAIL_GUESS_SERVERS_
+#define _MAIL_GUESS_SERVERS_
+
+typedef struct _EmailProvider {
+ /* Input */
+ char *domain;
+ char *email;
+ char *username;
+
+ /* Receiving server*/
+ char *recv_type;
+ char *recv_hostname;
+ char *recv_port;
+ char *recv_socket_type;
+ char *recv_username;
+ char *recv_auth;
+
+ /* Sending server */
+ char *send_type;
+ char *send_hostname;
+ char *send_port;
+ char *send_socket_type;
+ char *send_username;
+ char *send_auth;
+} EmailProvider;
+
+gboolean mail_guess_servers (EmailProvider *provider);
+
+#endif
diff --git a/capplet/mail-settings-view.c b/capplet/mail-settings-view.c
new file mode 100644
index 0000000000..ca08a41e18
--- /dev/null
+++ b/capplet/mail-settings-view.c
@@ -0,0 +1,298 @@
+/*
+ * 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 <glib/gi18n.h>
+#include "mail-settings-view.h"
+#include <libedataserver/e-account-list.h>
+#include "mail-view.h"
+#include "mail/mail-config.h"
+#include <e-util/e-account-utils.h>
+extern gboolean anjal_icon_decoration;
+
+struct _MailSettingsViewPrivate {
+ GtkWidget *tab_str;
+
+ GtkWidget *scroll;
+ GtkWidget *box;
+
+ EAccountList *accounts;
+};
+
+G_DEFINE_TYPE (MailSettingsView, mail_settings_view, GTK_TYPE_VBOX)
+
+enum {
+ VIEW_CLOSE,
+ SHOW_ACCOUNT,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
+static void msv_regen_view (MailSettingsView *acview);
+
+static void
+mail_settings_view_init (MailSettingsView *shell)
+{
+ shell->priv = g_new0(MailSettingsViewPrivate, 1);
+
+}
+
+static void
+mail_settings_view_finalize (GObject *object)
+{
+ /* MailSettingsView *shell = (MailSettingsView *)object; */
+
+ G_OBJECT_CLASS (mail_settings_view_parent_class)->finalize (object);
+}
+
+static void
+mail_settings_view_class_init (MailSettingsViewClass *klass)
+{
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+
+ mail_settings_view_parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = mail_settings_view_finalize;
+
+ signals[VIEW_CLOSE] =
+ g_signal_new ("view-close",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (MailSettingsViewClass , view_close),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ signals[SHOW_ACCOUNT] =
+ g_signal_new ("show-account",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (MailSettingsViewClass , show_account),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+}
+
+static void
+msv_edit_account(GtkButton *button, MailSettingsView *msv)
+{
+ EAccount *acc = g_object_get_data((GObject *)button, "account");
+
+ g_signal_emit (msv, signals[SHOW_ACCOUNT], 0, acc);
+}
+
+static void
+msv_delete_account(GtkButton *button, MailSettingsView *msv)
+{
+ EAccount *account = g_object_get_data((GObject *)button, "account");
+ EAccountList *account_list = e_get_account_list ();
+
+ e_account_list_remove (account_list, account);
+
+ e_account_list_save (account_list);
+
+ msv_regen_view (msv);
+
+}
+
+static void
+msv_account_added (EAccountList *al, EAccount *account, MailSettingsView *msv)
+{
+ msv_regen_view (msv);
+}
+
+#define PACK_BOX(w,s) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, s); gtk_widget_show(box); gtk_widget_show(w); gtk_box_pack_start((GtkBox *)acview->priv->box, box, FALSE, FALSE, 3);
+
+
+static void
+build_account_button (MailSettingsView *acview, EAccount *account)
+{
+ GtkWidget *box, *box1, *label, *tbox, *tlabel;
+ char *tmp;
+
+ box1 = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (box1);
+
+ label = gtk_button_new ();
+ tbox = gtk_hbox_new (FALSE, 0);
+
+ if (anjal_icon_decoration) {
+ tlabel = (GtkWidget *)gtk_image_new_from_stock (account ? "gtk-edit" : "gtk-new", GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show(tlabel);
+ gtk_box_pack_start((GtkBox *)tbox, tlabel, FALSE, FALSE, 6);
+ }
+
+ if (account)
+ tmp = g_strdup_printf("%s %s...", _("Modify"), e_account_get_string(account, E_ACCOUNT_ID_ADDRESS));
+ else
+ tmp = _("Add a new account");
+ tlabel = gtk_label_new(tmp);
+ if (account)
+ g_free(tmp);
+ gtk_widget_show(tlabel);
+ gtk_box_pack_start((GtkBox *)tbox, tlabel, FALSE, FALSE, 0);
+ gtk_widget_show(tbox);
+ gtk_container_add((GtkContainer *)label, tbox);
+ g_object_set_data ((GObject *)label, "account", account);
+ g_signal_connect(label, "clicked", G_CALLBACK(msv_edit_account), acview);
+ gtk_box_pack_start ((GtkBox *)box1, label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ if (account) {
+ tlabel = gtk_button_new_from_stock ("gtk-delete");
+ gtk_box_pack_start((GtkBox *)box1, tlabel, FALSE, FALSE, 12);
+ gtk_widget_show(tlabel);
+ g_object_set_data ((GObject *)tlabel, "account", account);
+ g_signal_connect (tlabel, "clicked", G_CALLBACK(msv_delete_account), acview);
+ }
+
+ PACK_BOX(box1,24);
+}
+
+static void
+msv_regen_view (MailSettingsView *acview)
+{
+ struct _EAccount *account;
+ EAccountList *accounts = acview->priv->accounts;
+ EIterator *node;
+ GtkWidget *box, *label;
+
+ gtk_container_foreach((GtkContainer *)acview->priv->box, (GtkCallback)gtk_widget_destroy, NULL);
+
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, _("<span size=\"large\" weight=\"bold\">Account management</span>"));
+ PACK_BOX(label,12);
+
+ node = e_list_get_iterator ((EList *) accounts);
+ while (e_iterator_is_valid (node)) {
+ account = (EAccount *) e_iterator_get (node);
+ build_account_button (acview, account);
+ e_iterator_next (node);
+ }
+ g_object_unref (node);
+ build_account_button (acview, NULL);
+}
+
+void
+mail_settings_view_construct (MailSettingsView *acview)
+{
+ acview->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_show (acview->priv->scroll);
+ gtk_container_add ((GtkContainer *)acview, acview->priv->scroll);
+ gtk_scrolled_window_set_policy ((GtkScrolledWindow *)acview->priv->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ acview->priv->box = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (acview->priv->box);
+ gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *)acview->priv->scroll, acview->priv->box);
+
+ acview->priv->accounts = e_get_account_list ();
+ g_signal_connect (acview->priv->accounts, "account-added", G_CALLBACK(msv_account_added), acview);
+ msv_regen_view (acview);
+ gtk_widget_show((GtkWidget *)acview);
+
+}
+
+MailSettingsView *
+mail_settings_view_new ()
+{
+ MailSettingsView *view = g_object_new (MAIL_SETTINGS_VIEW_TYPE, NULL);
+ view->type = MAIL_VIEW_SETTINGS;
+ view->uri = "settings://";
+
+ mail_settings_view_construct (view);
+
+ return view;
+}
+
+static gboolean
+msv_btn_expose (GtkWidget *w, GdkEventExpose *event, MailSettingsView *mfv)
+{
+ GdkPixbuf *img = g_object_get_data ((GObject *)w, "pbuf");
+ cairo_t *cr = gdk_cairo_create (w->window);
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, img, event->area.x-5, event->area.y-4);
+ cairo_paint(cr);
+ cairo_restore(cr);
+ cairo_destroy (cr);
+
+ return TRUE;
+}
+
+static void
+msv_close (GtkButton *w, MailSettingsView *mfv)
+{
+ g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
+}
+
+
+
+GtkWidget *
+mail_settings_view_get_tab_widget(MailSettingsView *mcv)
+{
+ GdkPixbuf *pbuf = gtk_widget_render_icon ((GtkWidget *)mcv, "gtk-close", GTK_ICON_SIZE_MENU, NULL);
+
+ GtkWidget *tool, *box, *img;
+ int w=-1, h=-1;
+ GtkWidget *tab_label;
+
+ img = gtk_image_new_from_pixbuf (pbuf);
+ g_object_set_data ((GObject *)img, "pbuf", pbuf);
+ g_signal_connect (img, "expose-event", G_CALLBACK(msv_btn_expose), mcv);
+
+ tool = gtk_button_new ();
+ gtk_button_set_relief((GtkButton *)tool, GTK_RELIEF_NONE);
+ gtk_button_set_focus_on_click ((GtkButton *)tool, FALSE);
+ gtk_widget_set_tooltip_text (tool, _("Close Tab"));
+ g_signal_connect (tool, "clicked", G_CALLBACK(msv_close), mcv);
+
+ box = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)box, img, FALSE, FALSE, 0);
+ gtk_container_add ((GtkContainer *)tool, box);
+ gtk_widget_show_all (tool);
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings(tool) , GTK_ICON_SIZE_MENU, &w, &h);
+ gtk_widget_set_size_request (tool, w+2, h+2);
+
+ box = gtk_label_new (_("Settings"));
+ tab_label = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)tab_label, box, FALSE, FALSE, 0);
+#ifndef ANJAL_SETTINGS
+ gtk_box_pack_start ((GtkBox *)tab_label, tool, FALSE, FALSE, 0);
+#endif
+ gtk_widget_show_all (tab_label);
+
+ return tab_label;
+
+}
+
+void
+mail_settings_view_activate (MailSettingsView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, GtkWidget *slider, gboolean act)
+{
+ if (!check_mail || !sort_by)
+ return;
+ //if (!GTK_WIDGET_VISIBLE(folder_tree))
+ // gtk_widget_show (slider);
+ gtk_widget_set_sensitive (check_mail, TRUE);
+ gtk_widget_set_sensitive (sort_by, FALSE);
+}
diff --git a/capplet/mail-settings-view.h b/capplet/mail-settings-view.h
new file mode 100644
index 0000000000..6a649d31ad
--- /dev/null
+++ b/capplet/mail-settings-view.h
@@ -0,0 +1,59 @@
+/*
+ * 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 _MAIL_SETTINGS_VIEW_H_
+#define _MAIL_SETTINGS_VIEW_H_
+
+#include <gtk/gtk.h>
+#include "mail-view.h"
+
+#define MAIL_SETTINGS_VIEW_TYPE (mail_settings_view_get_type ())
+#define MAIL_SETTINGS_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_SETTINGS_VIEW_TYPE, MailFolderView))
+#define MAIL_SETTINGS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MAIL_SETTINGS_VIEW_TYPE, MailFolderViewClass))
+#define IS_MAIL_SETTINGS_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_SETTINGS_VIEW_TYPE))
+#define IS_MAIL_SETTINGS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_SETTINGS_VIEW_TYPE))
+#define MAIL_SETTINGS_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MAIL_SETTINGS_VIEW_TYPE, MailFolderViewClass))
+
+
+typedef struct _MailSettingsViewPrivate MailSettingsViewPrivate;
+
+typedef struct _MailSettingsView {
+ GtkVBox parent;
+ int type;
+ char *uri;
+ MailViewFlags flags;
+ /* Base class of MailChildView ends */
+
+ MailSettingsViewPrivate *priv;
+} MailSettingsView;
+
+typedef struct _MailSettingsViewClass {
+ GtkVBoxClass parent_class;
+
+ void (* view_close) (MailSettingsView *);
+ void (* show_account) (MailSettingsView *, gpointer);
+} MailSettingsViewClass;
+
+MailSettingsView *mail_settings_view_new (void);
+GtkWidget * mail_settings_view_get_tab_widget(MailSettingsView *mcv);
+void mail_settings_view_activate (MailSettingsView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, GtkWidget *slider, gboolean act);
+#endif
diff --git a/capplet/mail-view.c b/capplet/mail-view.c
new file mode 100644
index 0000000000..cb6afb659d
--- /dev/null
+++ b/capplet/mail-view.c
@@ -0,0 +1,914 @@
+/*
+ * 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 <glib/gi18n.h>
+#include "mail/em-utils.h"
+#include "mail/mail-send-recv.h"
+#include "mail/mail-ops.h"
+#include "mail-view.h"
+#ifndef ANJAL_SETTINGS
+#include "mail-folder-view.h"
+#include "mail-composer-view.h"
+#include "mail-conv-view.h"
+#endif
+
+#include "mail-settings-view.h"
+
+#if HAVE_ANERLEY
+# include "mail-people-view.h"
+#endif
+#include "anjal-mail-view.h"
+#include "mail-account-view.h"
+#include "mail/em-folder-tree.h"
+#include <shell/e-shell-searchbar.h>
+
+struct _MailViewPrivate {
+
+ GtkWidget *box;
+ GList *children;
+ MailViewChild *current_view;
+ GtkWidget *new;
+ GtkWidget *search;
+ GtkWidget *search_entry;
+};
+
+enum {
+ VIEW_NEW,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+#undef MV_NEW_TAB
+
+G_DEFINE_TYPE (MailView, mail_view, ANJAL_MAIL_VIEW_TYPE)
+#ifndef ANJAL_SETTINGS
+static MailConvView * mv_switch_message_view (MailView *mv, const char *uri);
+#endif
+
+#define REALIGN_NODES(list,pdata) if (list->data != pdata) { \
+ list = g_list_remove (list, pdata); \
+ list = g_list_prepend (list, pdata); \
+ }
+
+void anjal_shell_view_restore_state (EShellView *view, const char *uri);
+
+static void
+mail_view_init (MailView *shell)
+{
+ shell->priv = g_new0(MailViewPrivate, 1);
+ shell->priv->children = NULL;
+ shell->priv->current_view = NULL;
+ shell->folder_tree = NULL;
+ shell->check_mail = NULL;
+ shell->sort_by = NULL;
+}
+
+static void
+mail_view_finalize (GObject *object)
+{
+ MailView *shell = (MailView *)object;
+ MailViewPrivate *priv = shell->priv;
+
+ g_list_free (priv->children);
+ g_free (priv);
+
+ G_OBJECT_CLASS (mail_view_parent_class)->finalize (object);
+}
+
+static void
+mv_set_folder_uri (AnjalMailView *mv, const char *uri)
+{
+#ifndef ANJAL_SETTINGS
+ mail_view_set_folder_uri ((MailView *)mv, uri);
+#endif
+}
+
+static void set_folder_tree (AnjalMailView *mv, EMFolderTree *tree)
+{
+ mail_view_set_folder_tree ((MailView *)mv, (GtkWidget *)tree);
+}
+
+static void
+set_search (AnjalMailView *mv, const char *search)
+{
+#ifndef ANJAL_SETTINGS
+ mail_view_set_search ((MailView *)mv, search);
+#endif
+}
+
+static void
+mail_view_class_init (MailViewClass *klass)
+{
+ GObjectClass * object_class = G_OBJECT_CLASS (klass);
+ AnjalMailViewClass *pclass;
+ signals[VIEW_NEW] =
+ g_signal_new ("view-new",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (MailViewClass , view_new),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ pclass = mail_view_parent_class = g_type_class_peek_parent (klass);
+ ((AnjalMailViewClass *)klass)->set_folder_uri = mv_set_folder_uri;
+ ((AnjalMailViewClass *)klass)->set_folder_tree = set_folder_tree;
+ ((AnjalMailViewClass *)klass)->set_search = set_search;
+
+ object_class->finalize = mail_view_finalize;
+
+};
+
+#ifdef MV_NEW_TAB
+static void
+mv_new_page (GtkButton *w, MailView *mv)
+{
+ mail_view_add_page (mv, MAIL_VIEW_FOLDER, NULL);
+ gtk_notebook_set_current_page (mv, g_list_length (mv->priv->children)-1);
+}
+#endif
+
+static void
+mv_switch (GtkNotebook *notebook,GtkNotebookPage *page, guint page_num, gpointer user_data)
+{
+ MailView *shell = (MailView *)notebook;
+ MailViewPrivate *priv = shell->priv;
+ MailViewChild *curr = priv->current_view;
+
+ curr->flags &= ~MAIL_VIEW_HOLD_FOCUS;
+
+#ifdef MV_NEW_TAB
+ if (page_num == g_list_length(priv->children) && shell->priv->new) {
+ mail_view_add_page (shell, MAIL_VIEW_FOLDER, NULL);
+ gtk_notebook_set_current_page (shell, g_list_length (shell->priv->children)-1);
+ } else {
+#endif
+ MailViewChild *child;
+ int current_child = gtk_notebook_get_current_page (notebook);
+
+ child = (MailViewChild *)gtk_notebook_get_nth_page (notebook, current_child);
+
+ priv->current_view = child;
+ REALIGN_NODES(shell->priv->children,child);
+
+#ifndef ANJAL_SETTINGS
+ if (child->type == MAIL_VIEW_COMPOSER)
+ mail_composer_view_activate ((MailComposerView *)child, shell->folder_tree, shell->check_mail, shell->sort_by, TRUE);
+ else if (child->type == MAIL_VIEW_MESSAGE)
+ mail_conv_view_activate ((MailConvView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_FOLDER) {
+ mail_folder_view_activate ((MailFolderView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, TRUE);
+ anjal_shell_view_restore_state (shell->shell_view, child->uri);
+ } else if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
+#else
+ if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
+#endif
+#if HAVE_ANERLEY
+ else if (child->type == MAIL_VIEW_PEOPLE)
+ mail_people_view_activate ((MailPeopleView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
+#endif
+
+
+
+#ifdef MV_NEW_TAB
+ }
+#endif
+}
+
+
+#ifdef MV_NEW_TAB
+static gboolean
+mv_btn_expose (GtkWidget *w, GdkEventExpose *event, MailView *mv)
+{
+ GdkPixbuf *img = g_object_get_data (w, "pbuf");
+ cairo_t *cr = gdk_cairo_create (w->window);
+ int wid = w->allocation.width;
+ int heig = w->allocation.height;
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, img, event->area.x-4, event->area.y-5);
+ cairo_paint(cr);
+ cairo_restore(cr);
+ cairo_destroy (cr);
+
+ return TRUE;
+}
+
+static void
+mv_new_tab_button (MailView *shell)
+{
+ int position;
+ GtkWidget *label = gtk_button_new (), *img;
+ GdkPixbuf *pbuf = e_icon_factory_get_icon ("gtk-add", E_ICON_SIZE_MENU);
+ GtkWidget *box = gtk_hbox_new (FALSE, 0);
+ int w,h;
+
+ img = gtk_image_new_from_pixbuf (pbuf);
+ g_object_set_data (img, "pbuf", pbuf);
+ g_signal_connect (img, "expose-event", mv_btn_expose, shell);
+ g_signal_connect (label, "clicked", G_CALLBACK(mv_new_page), shell);
+ gtk_button_set_image (label, img);
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings(label) , GTK_ICON_SIZE_MENU, &w, &h);
+ gtk_widget_set_size_request (label, w+2, h+2);
+
+ gtk_button_set_relief(label, GTK_RELIEF_NONE);
+ gtk_button_set_focus_on_click (label, FALSE);
+ gtk_widget_set_tooltip_text (label, _("New Tab"));
+ gtk_widget_show_all (label);
+ gtk_widget_show (box);
+ shell->priv->new = box;
+ position = gtk_notebook_append_page (shell, box, label);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (shell), box, FALSE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (shell), box, FALSE);
+
+}
+#endif
+
+void
+mail_view_construct (MailView *shell)
+{
+ gtk_notebook_set_show_tabs ((GtkNotebook *)shell, TRUE);
+ gtk_notebook_set_scrollable ((GtkNotebook *)shell, TRUE);
+ gtk_notebook_popup_disable ((GtkNotebook *)shell);
+#ifdef MV_NEW_TAB
+ mv_new_tab_button (shell);
+#endif
+ g_signal_connect_after (shell, "switch-page", G_CALLBACK(mv_switch), shell);
+}
+
+MailView *
+mail_view_new ()
+{
+ MailView *shell = g_object_new (MAIL_VIEW_TYPE, NULL);
+ mail_view_construct (shell);
+
+ return shell;
+}
+
+static void
+mv_message_shown (MailViewChild *mfv, MailView *mv)
+{
+ GtkWidget *arr;
+
+ if (!mv->slider)
+ return;
+
+ arr = g_object_get_data ((GObject *)mv->slider, "right-arrow");
+ //gtk_widget_hide (mv->folder_tree);
+ gtk_widget_show (arr);
+ gtk_widget_show (mv->slider);
+}
+
+static int
+list_data_pos (GList *list, gpointer data)
+{
+ int i=-1;
+ while (list) {
+ i++;
+ if (list->data == data)
+ return i;
+ list = list->next;
+ }
+
+ return i;
+}
+
+static int
+mv_get_page_number (GtkNotebook *note, GtkWidget *widget)
+{
+ int i, total;
+
+ total = gtk_notebook_get_n_pages (note);
+ for (i=0; i<total; i++) {
+ if (gtk_notebook_get_nth_page(note, i) == widget)
+ return i;
+ }
+
+ return total-1;
+}
+
+static void
+mv_close_mcv (MailViewChild *mfv, MailView *mv)
+{
+ int n = mv_get_page_number ((GtkNotebook *)mv, (GtkWidget *)mfv);
+ int pos = gtk_notebook_get_current_page ((GtkNotebook *)mv);
+ MailViewChild *child;
+ gboolean removing_viewed = FALSE;
+
+ if (g_list_length(mv->priv->children) == 1)
+ return;
+
+#ifndef ANJAL_SETTINGS
+ /* Make sure atleast one folder view is open. */
+ if (mfv->type == MAIL_VIEW_FOLDER) {
+ GList *tmp = mv->priv->children;
+ gboolean found = FALSE;
+
+ while (!found && tmp) {
+ MailViewChild *tchild = (MailViewChild *)tmp->data;
+
+ if (tchild && tchild != mfv && tchild->type == MAIL_VIEW_FOLDER)
+ found = true;
+ tmp = tmp->next;
+ }
+
+ if (!found)
+ return;
+ }
+
+ if (mfv->type == MAIL_VIEW_COMPOSER) {
+ if (!mail_composer_view_can_quit((MailComposerView *)mfv))
+ return;
+ }
+#endif
+
+ g_signal_handlers_block_by_func(mv, mv_switch, mv);
+ gtk_notebook_remove_page ((GtkNotebook *)mv, n);
+ g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
+
+ if (mfv == mv->priv->children->data)
+ removing_viewed = TRUE;
+ mv->priv->children = g_list_remove (mv->priv->children, mfv);
+
+ if (!removing_viewed)
+ return;
+
+ child = (MailViewChild *)mv->priv->children->data;
+ mv->priv->current_view = child;
+ pos = mv_get_page_number ((GtkNotebook *)mv, (GtkWidget *)child);
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, pos);
+
+#ifndef ANJAL_SETTINGS
+ if (child->type == MAIL_VIEW_COMPOSER)
+ mail_composer_view_activate ((MailComposerView *)child, mv->folder_tree, mv->check_mail, mv->sort_by, TRUE);
+ else if (child->type == MAIL_VIEW_MESSAGE)
+ mail_conv_view_activate ((MailConvView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_FOLDER) {
+ mail_folder_view_activate ((MailFolderView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, TRUE);
+ anjal_shell_view_restore_state ((EShellView *)mv->shell_view, child->uri);
+ //mail_search_set_state (mv->priv->search, ((MailFolderView *)child)->search_str, ((MailFolderView *)child)->search_state);
+ } else if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+#else
+ if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+
+#endif
+#if HAVE_ANERLEY
+ else if (child->type == MAIL_VIEW_PEOPLE)
+ mail_people_view_activate ((MailPeopleView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+#endif
+
+}
+
+#ifndef ANJAL_SETTINGS
+static void
+mv_message_new (MailFolderView *mfv, gpointer data, char *umid, MailView *mv)
+{
+ MailConvView *conv = (MailConvView *)mv_switch_message_view(mv, umid);
+ *(MailConvView **)data = conv;
+
+ if (conv)
+ conv->uri = g_strdup(umid);
+
+ return;
+}
+
+static void
+mv_search_set (MailFolderView *mfv, MailView *mv)
+{
+ anjal_shell_view_restore_state (mv->shell_view, ((MailViewChild *)mfv)->uri);
+ //mail_search_set_state (mv->priv->search, mfv->search_str, mfv->search_state);
+}
+
+static void
+mv_folder_loaded (MailFolderView *mfv, MailView *mv)
+{
+ g_signal_handlers_block_by_func(mfv, mv_folder_loaded, mv);
+ g_signal_emit (mv, signals[VIEW_NEW], 0);
+}
+
+static MailViewChild *
+mail_view_add_folder (MailView *mv, gpointer data, gboolean block)
+{
+ MailFolderView *mfv = mail_folder_view_new ();
+ gint position = 0;
+ mail_folder_view_set_folder_pane (mfv, mv->folder_tree);
+ if(!block)
+ mv->priv->current_view = (MailViewChild *)mfv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, mfv) : g_list_prepend (mv->priv->children, mfv);
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)mfv, mfv->tab_label);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)mfv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mfv, FALSE);
+
+ g_signal_connect (mfv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ if (!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mfv, FALSE, FALSE, 0);
+ g_signal_connect (mfv, "message-shown", G_CALLBACK(mv_message_shown), mv);
+ g_signal_connect (mfv, "message-new", G_CALLBACK(mv_message_new), mv);
+ g_signal_connect (mfv, "search-set", G_CALLBACK(mv_search_set), mv);
+ g_signal_connect (mfv, "view-loaded", G_CALLBACK (mv_folder_loaded), mv);
+ if (!block)
+ mail_folder_view_activate (mfv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, TRUE);
+
+ return (MailViewChild *)mfv;
+}
+
+static MailViewChild *
+mail_view_add_composer (MailView *mv, gpointer data, gboolean block)
+{
+ MailComposerView *mcv;
+ gint position = 0;
+ gboolean special = FALSE;
+
+ if (!data)
+ mcv = mail_composer_view_new ();
+ else if (data == (gpointer)-1) {
+ special = TRUE;
+ data = NULL;
+ } else
+ mcv = mail_composer_view_new_with_composer ((GtkWidget *)data);
+ if (!block)
+ mv->priv->current_view = (MailViewChild *)mcv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, mcv) : g_list_prepend (mv->priv->children, mcv);
+
+ if (!special)
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mcv->tab_label);
+ else {
+ int position = gtk_notebook_get_current_page ((GtkNotebook *)mv);
+ gtk_notebook_insert_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mcv->tab_label, position+1);
+ }
+
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, FALSE);
+ if (!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mcv, FALSE, FALSE, 0);
+ if (!block)
+ mail_composer_view_activate (mcv, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+
+ g_signal_connect (mcv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ g_signal_connect (mcv, "message-shown", G_CALLBACK(mv_message_shown), mv);
+
+ //mv_message_shown ((MailViewChild *)mcv, mv);
+ return (MailViewChild *)mcv;
+}
+
+static MailViewChild *
+mail_view_add_message (MailView *mv, gpointer data, gboolean block)
+{
+ MailConvView *mcv = mail_conv_view_new ();
+ gint position = 0;
+
+ gtk_widget_show ((GtkWidget *)mcv);
+ mcv->type = MAIL_VIEW_MESSAGE;
+ if(!block)
+ mv->priv->current_view = (MailViewChild *)mcv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, mcv) : g_list_prepend (mv->priv->children, mcv);
+
+ position = gtk_notebook_get_current_page ((GtkNotebook *)mv);
+ gtk_notebook_insert_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mail_conv_view_get_tab_widget(mcv), position+1);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, FALSE);
+ if (!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position+1);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mcv, FALSE, FALSE, 0);
+ if (!block)
+ mail_conv_view_activate (mcv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+
+ g_signal_connect (mcv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ g_signal_connect (mcv, "message-shown", G_CALLBACK(mv_message_shown), mv);
+
+ return (MailViewChild *)mcv;
+}
+
+#endif
+
+static void
+mv_show_acc_mcv (MailViewChild *mfv, EAccount *account, MailView *mv)
+{
+ mail_view_add_page(mv, MAIL_VIEW_ACCOUNT, account);
+}
+
+static MailViewChild *
+mail_view_add_settings (MailView *mv, gpointer data, gboolean block)
+{
+ MailSettingsView *msv = mail_settings_view_new ();
+ gint position = 0;
+
+ gtk_widget_show ((GtkWidget *)msv);
+ if(!block)
+ mv->priv->current_view = (MailViewChild *)msv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, msv) : g_list_prepend (mv->priv->children, msv);
+
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)msv, mail_settings_view_get_tab_widget(msv));
+ g_signal_connect (msv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ g_signal_connect (msv, "show-account", G_CALLBACK(mv_show_acc_mcv), mv);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
+ if (!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
+ if(!block)
+ mail_settings_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+
+ return (MailViewChild *)msv;
+}
+
+#if HAVE_ANERLEY
+void
+mail_view_switch_to_people (MailView* mv, MailViewChild *mpv)
+{
+ GList *tmp = mv->priv->children;
+ int position = 0;
+
+ position = mv_get_page_number(mv, mpv);
+ REALIGN_NODES(mv->priv->children,mpv);
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ mail_people_view_activate ((MailPeopleView *)mpv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+}
+#endif
+
+void
+mail_view_switch_to_settings (MailView* mv, MailViewChild *mpv)
+{
+ int position = 0;
+
+ position = mv_get_page_number((GtkNotebook *)mv, (GtkWidget *)mpv);
+ REALIGN_NODES(mv->priv->children,mpv);
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ mail_settings_view_activate ((MailSettingsView *)mpv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+}
+
+#if HAVE_ANERLEY
+static MailViewChild *
+mail_view_add_people (MailView *mv, gpointer data, gboolean block)
+{
+ MailPeopleView *msv = mail_people_view_new ();
+ gint position = 0;
+
+ gtk_widget_show ((GtkWidget *)msv);
+ if (!block)
+ mv->priv->current_view = (MailViewChild *)msv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, msv) : g_list_prepend (mv->priv->children, msv);
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)msv, mail_people_view_get_tab_widget(msv));
+ g_signal_connect (msv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
+ if (!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
+ if(!block)
+ mail_people_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
+
+ return (MailViewChild *)msv;
+}
+#endif
+
+static MailViewChild *
+mail_view_add_account (MailView *mv, gpointer data, gboolean block)
+{
+ MailAccountView *msv = mail_account_view_new (data);
+ gint position = 0;
+
+ gtk_widget_show ((GtkWidget *)msv);
+ if (!block)
+ mv->priv->current_view = (MailViewChild *)msv;
+ mv->priv->children = block ? g_list_append(mv->priv->children, msv) : g_list_prepend (mv->priv->children, msv);
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)msv, mail_account_view_get_tab_widget(msv));
+ g_signal_connect_after (msv, "view-close", G_CALLBACK(mv_close_mcv), mv);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
+ if(!block)
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
+ gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
+ if(!block)
+ mail_account_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+
+ return (MailViewChild *)msv;
+}
+
+MailViewChild *
+mail_view_add_page (MailView *mv, guint16 type, gpointer data)
+{
+ MailViewChild *child = NULL, *current_child;
+ gboolean block = FALSE;
+
+ current_child = mv->priv->current_view;
+ if (current_child && (current_child->flags & MAIL_VIEW_HOLD_FOCUS))
+ block = TRUE;
+
+ g_signal_handlers_block_by_func(mv, mv_switch, mv);
+ switch (type){
+#ifndef ANJAL_SETTINGS
+ case MAIL_VIEW_FOLDER:
+ child = mail_view_add_folder (mv, data, block);
+ break;
+
+ case MAIL_VIEW_COMPOSER:
+ child = mail_view_add_composer (mv, data, block);
+ break;
+ case MAIL_VIEW_MESSAGE:
+ child = mail_view_add_message (mv, data, block);
+ break;
+#endif
+ case MAIL_VIEW_SETTINGS:
+ child = mail_view_add_settings (mv, data, block);
+ break;
+#if HAVE_ANERLEY
+ case MAIL_VIEW_PEOPLE:
+ child = mail_view_add_people (mv, data, block);
+ break;
+#endif
+ case MAIL_VIEW_ACCOUNT:
+ child = mail_view_add_account (mv, data, block);
+ break;
+ }
+ gtk_widget_grab_focus((GtkWidget *)child);
+ child->type = type;
+#ifdef MV_NEW_TAB
+ gtk_notebook_reorder_child (mv, mv->priv->new, -1);
+ gtk_notebook_set_current_page (mv, g_list_length (mv->priv->children)-1);
+#endif
+ g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
+
+ child->flags = 0;
+
+ return child;
+}
+
+#ifndef ANJAL_SETTINGS
+static void
+mv_switch_folder_view (MailView *mv, const char *uri)
+{
+ int i=0, len = g_list_length(mv->priv->children);
+ GList *tmp = mv->priv->children;
+ while (i<len) {
+ MailViewChild *child = (MailViewChild *)gtk_notebook_get_nth_page ((GtkNotebook *)mv, i);
+
+ if (child->type == MAIL_VIEW_FOLDER && !strcmp (uri, child->uri)) {
+ if(child != mv->priv->current_view) {
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, i);
+ //REALIGN_NODES(mv->priv->children, child);
+ }
+ return;
+ }
+ i++;
+ tmp = tmp->next;
+ }
+
+ mail_view_add_page (mv, MAIL_VIEW_FOLDER, NULL);
+ mail_folder_view_set_folder_uri ((MailFolderView *)mv->priv->current_view, uri);
+}
+
+static MailConvView *
+mv_switch_message_view (MailView *mv, const char *uri)
+{
+ int i=0;
+ GList *tmp = mv->priv->children;
+ while (tmp) {
+ MailViewChild *child = tmp->data;
+ if (child->type == MAIL_VIEW_MESSAGE && !strcmp (uri, child->uri)) {
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, i);
+ mail_conv_view_activate ((MailConvView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
+ REALIGN_NODES(mv->priv->children,child);
+ return NULL;
+ }
+ i++;
+ tmp = tmp->next;
+ }
+
+ return (MailConvView *)mail_view_add_page (mv, MAIL_VIEW_MESSAGE, NULL);
+}
+
+void
+mail_view_set_folder_uri (MailView *mv, const char *uri)
+{
+
+ mv_switch_folder_view (mv, uri);
+ //mail_folder_view_set_folder_uri (mv->priv->current_view, uri);
+}
+
+void
+mail_view_show_sort_popup (MailView *mv, GtkWidget *button)
+{
+ mail_folder_view_show_sort_popup ((MailFolderView *)mv->priv->current_view, button);
+}
+
+void
+mail_view_show_list (MailView *mv)
+{
+ MailViewChild *child = (MailViewChild *)mv->priv->current_view;
+
+ if (child->type == MAIL_VIEW_MESSAGE)
+ mv_close_mcv (child, mv);
+ else if (child->type == MAIL_VIEW_FOLDER)
+ mail_folder_view_show_list ((MailFolderView *)mv->priv->current_view);
+
+
+}
+#endif
+void
+mail_view_close_view (MailView *mv)
+{
+ MailViewChild *child = (MailViewChild *)mv->priv->current_view;
+
+ mv_close_mcv (child, mv);
+}
+
+#ifndef ANJAL_SETTINGS
+static void
+mv_slider_clicked (GtkButton *slider, MailView *mv)
+{
+ gtk_widget_hide (mv->slider);
+ gtk_widget_show (mv->folder_tree);
+ if (mv->priv->current_view->type == MAIL_VIEW_FOLDER)
+ mail_folder_view_show_list ((MailFolderView *)mv->priv->current_view);
+ else {
+ gtk_widget_show (mv->folder_tree);
+ gtk_widget_hide ((GtkWidget *)slider);
+ }
+}
+
+void
+mail_view_set_slider (MailView *mv, GtkWidget *slider)
+{
+ mv->slider = slider;
+ g_signal_connect (slider, "clicked", G_CALLBACK(mv_slider_clicked), mv);
+}
+#endif
+
+void
+mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree)
+{
+ mv->folder_tree = tree;
+}
+
+#if 0
+static gboolean
+mv_tree_click_cb (GtkWidget *w, GdkEventButton *event, MailView *mv)
+{
+ if ((event->button == 1 && event->type == GDK_2BUTTON_PRESS) || event->button == 2) {
+ GtkTreeSelection *selection;
+ GtkTreePath *tree_path;
+
+ if (!gtk_tree_view_get_path_at_pos ((GtkTreeView *)w, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL))
+ return FALSE;
+ mail_view_add_page (mv, MAIL_VIEW_FOLDER, NULL);
+ gtk_notebook_set_current_page ((GtkNotebook *)mv, g_list_length (mv->priv->children)-1);
+ selection = gtk_tree_view_get_selection ((GtkTreeView *)w);
+ gtk_tree_selection_unselect_path (selection, tree_path);
+ gtk_tree_selection_select_path(selection, tree_path);
+ gtk_tree_view_set_cursor ((GtkTreeView *)w, tree_path, NULL, FALSE);
+
+
+ return TRUE;
+ }
+ return FALSE;
+}
+#endif
+
+void
+mail_view_set_folder_tree (MailView *mv, GtkWidget *tree)
+{
+ mv->tree = tree;
+ //em_folder_tree_set_skip_double_click ((EMFolderTree *)tree, FALSE);
+ //g_signal_connect ((GObject *)em_folder_tree_get_tree_view((EMFolderTree *)tree), "button-press-event", G_CALLBACK(mv_tree_click_cb), mv);
+}
+
+void
+mail_view_set_check_email (MailView *mv, GtkWidget *button)
+{
+ mv->check_mail = button;;
+}
+
+void
+mail_view_set_sort_by (MailView *mv, GtkWidget *button)
+{
+ mv->sort_by = button;;
+}
+
+static void
+mv_spinner_show (MailView *mv, gboolean show)
+{
+ GtkWidget *spinner = g_object_get_data ((GObject *)mv->check_mail, "spinner");
+ GtkWidget *icon = g_object_get_data ((GObject *)mv->check_mail, "icon");
+
+ if(show) {
+ gtk_widget_show (spinner);
+ gtk_widget_hide(icon);
+ gtk_button_set_relief ((GtkButton *)mv->check_mail, GTK_RELIEF_NORMAL);
+
+ } else {
+ gtk_widget_show (icon);
+ gtk_widget_hide(spinner);
+ gtk_button_set_relief ((GtkButton *)mv->check_mail, GTK_RELIEF_NONE);
+ }
+}
+
+static void
+mv_spinner_done (CamelFolder *f, gpointer data)
+{
+ MailView *mv = (MailView *)data;
+ mv_spinner_show (mv, FALSE);
+}
+#ifndef ANJAL_SETTINGS
+void
+mail_view_check_mail(MailView *mv, gboolean deep)
+{
+ MailViewChild *child = (MailViewChild *)mv->priv->current_view;
+
+ if (child && child->type == MAIL_VIEW_FOLDER) {
+ mail_folder_view_check_mail ((MailFolderView *)child);
+ CamelFolder *folder;
+
+ if ((folder = em_folder_tree_get_selected_folder ((EMFolderTree *)mv->tree)) != NULL) {
+ mv_spinner_show (mv, TRUE);
+ mail_refresh_folder(folder, mv_spinner_done, mv);
+ }
+ }
+
+ if (deep) {
+ em_utils_clear_get_password_canceled_accounts_flag ();
+ mail_send_receive (NULL);
+ }
+}
+
+void
+mail_view_save (MailView *mv)
+{
+ GList *child = mv->priv->children;
+ MailViewChild *cview;
+
+ while (child) {
+ cview = (MailViewChild *)child->data;
+ if (cview->type == MAIL_VIEW_FOLDER) {
+ mail_folder_view_save ((MailFolderView *)cview);
+ }
+ child = child->next;
+ }
+}
+
+void
+mail_view_set_search (MailView *mv, const char *search)
+{
+ MailViewChild *child = (MailViewChild *)mv->priv->current_view;
+
+ if (child && child->type == MAIL_VIEW_FOLDER) {
+ MailFolderView *mfv = (MailFolderView *)child;
+
+ mail_folder_view_set_search (mfv, search, e_shell_searchbar_get_search_text ((EShellSearchbar *)mv->priv->search_entry));
+ }
+}
+#endif
+
+void
+mail_view_set_search_entry (MailView *mv, GtkWidget *entry)
+{
+ mv->priv->search_entry = entry;
+}
+
+void
+mail_view_init_search (MailView *mv, GtkWidget *search)
+{
+ mv->priv->search = search;
+}
+
+void
+mail_view_set_shell_view (MailView *mv, EShellView *shell)
+{
+ mv->shell_view = shell;
+}
diff --git a/capplet/mail-view.h b/capplet/mail-view.h
new file mode 100644
index 0000000000..339d690c43
--- /dev/null
+++ b/capplet/mail-view.h
@@ -0,0 +1,97 @@
+/*
+ * 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 _MAIL_VIEW_H_
+#define _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))
+#define IS_MAIL_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MAIL_VIEW_TYPE))
+#define IS_MAIL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_VIEW_TYPE))
+#define MAIL_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MAIL_VIEW_TYPE, MailViewClass))
+
+enum {
+ MAIL_VIEW_FOLDER=1,
+ MAIL_VIEW_COMPOSER,
+ MAIL_VIEW_MESSAGE,
+ MAIL_VIEW_ACCOUNT,
+ MAIL_VIEW_SETTINGS,
+ MAIL_VIEW_PEOPLE
+};
+
+typedef struct _MailViewPrivate MailViewPrivate;
+
+typedef struct _MailView {
+ AnjalMailView parent;
+
+ GtkWidget *tree; /* Actual tree */
+ GtkWidget *folder_tree;
+ GtkWidget *slider;
+ GtkWidget *check_mail;
+ GtkWidget *sort_by;
+ MailViewPrivate *priv;
+ EShellView *shell_view;
+} MailView;
+
+typedef struct _MailViewClass {
+ AnjalMailViewClass parent_class;
+ void (* view_new) (MailView*);
+
+} MailViewClass;
+
+typedef enum {
+ MAIL_VIEW_HOLD_FOCUS=1,
+} MailViewFlags;
+
+typedef struct _MailViewChild {
+ GtkVBox parent;
+ int type;
+ char *uri;
+ MailViewFlags flags;
+}MailViewChild;
+
+MailView * mail_view_new (void);
+void mail_view_set_folder_uri (MailView *mv, const char *uri);
+void mail_view_show_sort_popup (MailView *mv, GtkWidget *);
+void mail_view_show_list (MailView *mv);
+void mail_view_close_view (MailView *mv);
+void mail_view_set_check_email (MailView *mv, GtkWidget *button);
+void mail_view_set_sort_by (MailView *mv, GtkWidget *button);
+void mail_view_check_mail(MailView *mv, gboolean deep);
+void mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree);
+void mail_view_set_folder_tree (MailView *mv, GtkWidget *tree);
+void mail_view_save (MailView *mv);
+MailViewChild * mail_view_add_page (MailView *mv, guint16 type, gpointer data);
+void mail_view_set_search (MailView *view, const char *search);
+void mail_view_set_slider (MailView *mv, GtkWidget *slider);
+void mail_view_init_search (MailView *mv, GtkWidget *search);
+void mail_view_switch_to_people (MailView* mv, MailViewChild *mpv);
+void mail_view_switch_to_settings (MailView* mv, MailViewChild *mpv);
+void mail_view_set_search_entry (MailView *mv, GtkWidget *entry);
+void mail_view_set_shell_view (MailView *mv, EShellView *shell);
+
+#endif
diff --git a/configure.ac b/configure.ac
index 45b8d4afd6..f32871f571 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1741,6 +1741,7 @@ smime/Makefile
smime/lib/Makefile
smime/gui/Makefile
sounds/Makefile
+capplet/Makefile
evolution-zip
evolution-calendar.pc
evolution-mail.pc
diff --git a/data/Makefile.am b/data/Makefile.am
index 8bbcdedda7..3c35078826 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,6 @@
desktopdir = $(datadir)/applications
-desktop_in_in_file = evolution.desktop.in.in
+desktop_in_in_file = evolution.desktop.in.in \
+ evolution-settings.desktop.in.in
desktop_file = $(desktop_in_in_file:.desktop.in.in=.desktop)
%.desktop.in: %.desktop.in.in
sed -e "s|\@BASE_VERSION\@|$(BASE_VERSION)|" -e "s|\@DATASERVER_EXEC_VERSION\@|$(DATASERVER_EXEC_VERSION)|" $< > $@
diff --git a/data/evolution-settings.desktop.in.in b/data/evolution-settings.desktop.in.in
new file mode 100644
index 0000000000..fd03e69225
--- /dev/null
+++ b/data/evolution-settings.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+_Name=Email Settings
+_GenericName=Email Settings
+_Comment=Configure email accounts
+Exec=evolution-settings
+Icon=evolution
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;Settings;X-GNOME-PersonalSettings;
+OnlyShowIn=GNOME;
+StartupNotify=true