[evolution/anjal-evo-2-30: 1/2] Changes to incorporate Anjal for Evolution 2.30.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/anjal-evo-2-30: 1/2] Changes to incorporate Anjal for Evolution 2.30.
- Date: Thu, 26 Nov 2009 09:11:39 +0000 (UTC)
commit f557d941251e88a90ad9a590e0ec4434c4d339a0
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Thu Nov 26 14:21:34 2009 +0530
Changes to incorporate Anjal for Evolution 2.30.
composer/e-composer-header-table.c | 22 +
composer/e-composer-header-table.h | 4 +
configure.ac | 2 +
e-util/e-marshal.list | 1 +
mail/Makefile.am | 7 +-
mail/anjal-mail-view.c | 139 +++++
mail/anjal-mail-view.h | 76 +++
mail/e-mail-reader-utils.c | 1 +
mail/e-mail-reader.c | 2 +-
mail/e-mail-reader.h | 6 +-
mail/e-mail-store.c | 3 +-
mail/em-utils.c | 9 +-
mail/mail-mt.c | 13 +-
mail/mail-mt.h | 2 +
mail/mail-send-recv.c | 2 +-
modules/mail/Makefile.am | 75 +++-
modules/mail/anjal-shell-backend.c | 292 ++++++++++
modules/mail/anjal-shell-backend.h | 75 +++
modules/mail/anjal-shell-content.c | 308 +++++++++++
modules/mail/anjal-shell-content.h | 92 ++++
modules/mail/anjal-shell-view-actions.c | 875 ++++++++++++++++++++++++++++++
modules/mail/anjal-shell-view-actions.h | 257 +++++++++
modules/mail/anjal-shell-view-private.c | 292 ++++++++++
modules/mail/anjal-shell-view-private.h | 181 ++++++
modules/mail/anjal-shell-view.c | 609 +++++++++++++++++++++
modules/mail/anjal-shell-view.h | 76 +++
modules/mail/e-mail-anjal-shared.c | 691 +++++++++++++++++++++++
modules/mail/e-mail-shell-backend.c | 691 +-----------------------
modules/mail/e-mail-shell-content.c | 1 +
modules/mail/e-mail-shell-sidebar.c | 6 +-
modules/mail/e-mail-shell-view-actions.c | 1 +
modules/mail/e-mail-shell-view-private.c | 1 +
modules/mail/e-mail-shell-view.c | 1 +
shell/e-shell-content.c | 130 +++--
shell/e-shell-content.h | 6 +
shell/e-shell-taskbar.c | 6 +
shell/e-shell-taskbar.h | 1 +
shell/e-shell-window-private.c | 128 +++--
shell/e-shell-window-private.h | 4 +
shell/e-shell-window.c | 32 +-
shell/e-shell-window.h | 4 +
shell/e-shell.c | 4 +-
42 files changed, 4326 insertions(+), 802 deletions(-)
---
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index e7972e2..401da07 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -1050,6 +1050,28 @@ e_composer_header_table_get_header (EComposerHeaderTable *table,
return table->priv->headers[type];
}
+void
+e_composer_header_table_set_header_visible (EComposerHeaderTable *table,
+ EComposerHeaderType type,
+ gboolean visible)
+{
+ EComposerHeader *header;
+
+ header = e_composer_header_table_get_header (table, type);
+ e_composer_header_set_visible (header, visible);
+
+ /* Signature widgets track the "From" header. */
+ if (type == E_COMPOSER_HEADER_FROM) {
+ if (visible) {
+ gtk_widget_show (table->priv->signature_label);
+ gtk_widget_show (table->priv->signature_combo_box);
+ } else {
+ gtk_widget_hide (table->priv->signature_label);
+ gtk_widget_hide (table->priv->signature_combo_box);
+ }
+ }
+}
+
EAccount *
e_composer_header_table_get_account (EComposerHeaderTable *table)
{
diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h
index 91ad56d..f5f65a9 100644
--- a/composer/e-composer-header-table.h
+++ b/composer/e-composer-header-table.h
@@ -149,6 +149,10 @@ const gchar * e_composer_header_table_get_subject
void e_composer_header_table_set_subject
(EComposerHeaderTable *table,
const gchar *subject);
+void e_composer_header_table_set_header_visible
+ (EComposerHeaderTable *table,
+ EComposerHeaderType type,
+ gboolean visible);
G_END_DECLS
diff --git a/configure.ac b/configure.ac
index 56886b9..309e113 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1399,6 +1399,8 @@ AC_SUBST(componentdir)
moduledir="$privlibdir/modules"
AC_SUBST(moduledir)
+anjalmoduledir="$privlibdir/anjal"
+AC_SUBST(anjalmoduledir)
uidir="$privdatadir/ui"
AC_SUBST(uidir)
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index 9e19bae..813234b 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -1,4 +1,5 @@
BOOLEAN:BOXED,STRING
+BOOLEAN:BOXED,POINTER,POINTER
BOOLEAN:INT,INT,OBJECT,INT,INT,UINT
BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT
BOOLEAN:NONE
diff --git a/mail/Makefile.am b/mail/Makefile.am
index e06b175..705fede 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -89,7 +89,8 @@ mailinclude_HEADERS = \
mail-session.h \
mail-tools.h \
mail-vfolder.h \
- message-list.h
+ message-list.h \
+ anjal-mail-view.h
libevolution_mail_la_SOURCES = \
e-mail-attachment-bar.c \
@@ -145,7 +146,9 @@ libevolution_mail_la_SOURCES = \
mail-session.c \
mail-tools.c \
mail-vfolder.c \
- message-list.c
+ message-list.c \
+ anjal-mail-view.c \
+ anjal-mail-view.h
if ENABLE_SMIME
SMIME_LIBS = \
diff --git a/mail/anjal-mail-view.c b/mail/anjal-mail-view.c
new file mode 100644
index 0000000..5178b56
--- /dev/null
+++ b/mail/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/mail/anjal-mail-view.h b/mail/anjal-mail-view.h
new file mode 100644
index 0000000..647d07b
--- /dev/null
+++ b/mail/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/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 3cfc3b3..a3d7571 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -40,6 +40,7 @@
#include "mail/mail-ops.h"
#include "mail/mail-tools.h"
#include "mail/mail-vfolder.h"
+#include "mail/message-list.h"
void
e_mail_reader_activate (EMailReader *reader,
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 02739f0..bc1673a 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -50,7 +50,7 @@
#include "mail/mail-config.h"
#include "mail/mail-ops.h"
#include "mail/mail-vfolder.h"
-
+#include "mail/message-list.h"
enum {
CHANGED,
FOLDER_LOADED,
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index e9f9a3a..9425d97 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include <camel/camel-folder.h>
#include <mail/em-format-html-display.h>
-#include <mail/message-list.h>
#include <shell/e-shell-backend.h>
/* Standard GObject macros */
@@ -54,6 +53,7 @@ G_BEGIN_DECLS
typedef struct _EMailReader EMailReader;
typedef struct _EMailReaderIface EMailReaderIface;
+struct _MessageList;
enum {
E_MAIL_READER_HAVE_ACCOUNT = 1 << 0,
@@ -82,7 +82,7 @@ struct _EMailReaderIface {
gboolean (*get_hide_deleted) (EMailReader *reader);
EMFormatHTMLDisplay *
(*get_html_display) (EMailReader *reader);
- MessageList * (*get_message_list) (EMailReader *reader);
+ struct _MessageList * (*get_message_list) (EMailReader *reader);
GtkMenu * (*get_popup_menu) (EMailReader *reader);
EShellBackend * (*get_shell_backend) (EMailReader *reader);
GtkWindow * (*get_window) (EMailReader *reader);
@@ -110,7 +110,7 @@ GtkActionGroup *
gboolean e_mail_reader_get_hide_deleted (EMailReader *reader);
EMFormatHTMLDisplay *
e_mail_reader_get_html_display (EMailReader *reader);
-MessageList * e_mail_reader_get_message_list (EMailReader *reader);
+struct _MessageList * e_mail_reader_get_message_list (EMailReader *reader);
GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader);
EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader);
GtkWindow * e_mail_reader_get_window (EMailReader *reader);
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c
index 1fc3eb5..2234072 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -264,7 +264,8 @@ e_mail_store_init (const gchar *data_dir)
{
static gboolean initialized = FALSE;
- g_return_if_fail (!initialized);
+ if (initialized)
+ return;
g_return_if_fail (data_dir != NULL);
/* Initialize global variables. */
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 407c686..64c47be 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -79,6 +79,7 @@
#include "em-format-quote.h"
#include "e-mail-local.h"
+extern char * shell_builtin_backend;
static void emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data);
#define d(x)
@@ -93,7 +94,7 @@ em_utils_get_data_dir (void)
* better way. Ideally, nothing below the module layer
* should need to know about the user data directory. */
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
return e_shell_backend_get_data_dir (shell_backend);
}
@@ -108,7 +109,7 @@ em_utils_get_config_dir (void)
* better way. Ideally, nothing below the module layer
* should need to know about the user config directory. */
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
return e_shell_backend_get_config_dir (shell_backend);
}
@@ -2021,7 +2022,7 @@ em_utils_show_error_silent (GtkWidget *widget)
EActivity *activity;
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
activity = e_alert_activity_new_warning (widget);
e_shell_backend_add_activity (shell_backend, activity);
@@ -2041,7 +2042,7 @@ em_utils_show_info_silent (GtkWidget *widget)
EActivity *activity;
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
activity = e_alert_activity_new_info (widget);
e_shell_backend_add_activity (shell_backend, activity);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index d1aea41..2c691ea 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -46,6 +46,8 @@
/*#define MALLOC_CHECK*/
#define d(x)
+char *shell_builtin_backend = "mail";
+
static void mail_operation_status(CamelOperation *op, const gchar *what, gint pc, gpointer data);
/* background operation status stuff */
@@ -96,7 +98,7 @@ end_event_callback (CamelObject *o, EActivity *activity, gpointer error)
EShellBackend *shell_backend;
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
if (activity != NULL) {
e_activity_complete (activity);
@@ -846,7 +848,7 @@ op_status_exec (struct _op_status_msg *m)
g_return_if_fail (mail_in_main_thread ());
shell = e_shell_get_default ();
- shell_backend = e_shell_get_backend_by_name (shell, "mail");
+ shell_backend = e_shell_get_backend_by_name (shell, shell_builtin_backend);
g_mutex_lock (mail_msg_lock);
@@ -966,3 +968,10 @@ mail_operation_status (CamelOperation *op, const gchar *what, gint pc, gpointer
m->data = data;
mail_msg_main_loop_push(m);
}
+
+void
+mail_mt_set_backend (char *backend)
+{
+ shell_builtin_backend = backend;
+}
+
diff --git a/mail/mail-mt.h b/mail/mail-mt.h
index 64641ee..e8d046d 100644
--- a/mail/mail-mt.h
+++ b/mail/mail-mt.h
@@ -107,6 +107,8 @@ gint mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyn
/* wait for all outstanding async events to complete */
gint mail_async_event_destroy(MailAsyncEvent *ea);
+void mail_mt_set_backend (char *backend);
+
/* Call a function in the gui thread, wait for it to return, type is the marshaller to use */
typedef enum {
MAIL_CALL_p_p,
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 1495f09..b5e135c 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -348,7 +348,7 @@ static gchar *
format_url (const gchar *internal_url, const gchar *account_name)
{
CamelURL *url;
- gchar *pretty_url;
+ gchar *pretty_url = NULL;
url = camel_url_new(internal_url, NULL);
if (account_name) {
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index 15ee1fc..a521a81 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -1,4 +1,5 @@
-module_LTLIBRARIES = libevolution-module-mail.la
+module_LTLIBRARIES = libevolution-module-mail.la
+anjalmodule_LTLIBRARIES = libevolution-module-anjal.la
libevolution_module_mail_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -71,4 +72,76 @@ libevolution_module_mail_la_LIBADD = \
libevolution_module_mail_la_LDFLAGS = \
-avoid-version -module $(NO_UNDEFINED)
+libevolution_module_anjal_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/mail \
+ -I$(top_srcdir)/widgets \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(EVOLUTION_MAIL_CFLAGS) \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_UIDIR=\""$(uidir)"\" \
+ -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
+ -DG_LOG_DOMAIN=\"evolution-module-mail\"
+
+libevolution_module_anjal_la_SOURCES = \
+ evolution-module-anjal.c \
+ e-mail-attachment-handler.c \
+ e-mail-attachment-handler.h \
+ e-mail-config-hook.c \
+ e-mail-config-hook.h \
+ e-mail-event-hook.c \
+ e-mail-event-hook.h \
+ e-mail-junk-hook.c \
+ e-mail-junk-hook.h \
+ anjal-shell-backend.c \
+ anjal-shell-backend.h \
+ anjal-shell-content.c \
+ anjal-shell-content.h \
+ e-mail-shell-migrate.c \
+ e-mail-shell-migrate.h \
+ e-mail-shell-settings.c \
+ e-mail-shell-settings.h \
+ e-mail-shell-sidebar.c \
+ e-mail-shell-sidebar.h \
+ anjal-shell-view.c \
+ anjal-shell-view.h \
+ anjal-shell-view-actions.c \
+ anjal-shell-view-actions.h \
+ anjal-shell-view-private.c \
+ anjal-shell-view-private.h \
+ em-account-prefs.c \
+ em-account-prefs.h \
+ em-composer-prefs.c \
+ em-composer-prefs.h \
+ em-mailer-prefs.c \
+ em-mailer-prefs.h \
+ em-network-prefs.c \
+ em-network-prefs.h
+
+libevolution_module_anjal_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/em-format/libemformat.la \
+ $(top_builddir)/filter/libfilter.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/composer/libcomposer.la \
+ $(top_builddir)/widgets/table/libetable.la \
+ $(top_builddir)/widgets/text/libetext.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
+ $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/mail/importers/libevolution-mail-importers.la \
+ $(top_builddir)/em-format/libemformat.la \
+ $(top_builddir)/widgets/menus/libmenus.la \
+ $(top_builddir)/filter/libfilter.la \
+ $(EVOLUTION_MAIL_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(CAMEL_LIBS) \
+ $(GTKHTML_LIBS) \
+ $(E_WIDGETS_LIBS)
+
+libevolution_module_anjal_la_LDFLAGS = \
+ -avoid-version -module $(NO_UNDEFINED)
+
+
-include $(top_srcdir)/git.mk
diff --git a/modules/mail/anjal-shell-backend.c b/modules/mail/anjal-shell-backend.c
new file mode 100644
index 0000000..4c7e904
--- /dev/null
+++ b/modules/mail/anjal-shell-backend.c
@@ -0,0 +1,292 @@
+/*
+ * anjal-shell-backend.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "anjal-shell-backend.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-session.h>
+#include <camel/camel-url.h>
+
+#include "e-util/e-account-utils.h"
+#include "e-util/e-binding.h"
+#include "e-util/e-error.h"
+#include "e-util/e-import.h"
+#include "e-util/e-util.h"
+#include "shell/e-shell.h"
+#include "shell/e-shell-window.h"
+#include "composer/e-msg-composer.h"
+#include "widgets/misc/e-preferences-window.h"
+
+#include "e-mail-shell-migrate.h"
+#include "e-mail-shell-settings.h"
+#include "e-mail-shell-sidebar.h"
+#include "anjal-shell-view.h"
+
+#include "e-mail-browser.h"
+#include "e-mail-local.h"
+#include "e-mail-reader.h"
+#include "e-mail-store.h"
+#include "em-account-editor.h"
+#include "em-account-prefs.h"
+#include "em-composer-prefs.h"
+#include "em-composer-utils.h"
+#include "em-folder-utils.h"
+#include "em-format-hook.h"
+#include "em-format-html-display.h"
+#include "em-mailer-prefs.h"
+#include "em-network-prefs.h"
+#include "em-utils.h"
+#include "mail-config.h"
+#include "mail-ops.h"
+#include "mail-send-recv.h"
+#include "mail-session.h"
+#include "mail-vfolder.h"
+#include "importers/mail-importer.h"
+
+#define ANJAL_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendPrivate))
+
+#define BACKEND_NAME "anjal"
+#define QUIT_POLL_INTERVAL 1 /* seconds */
+
+struct _AnjalShellBackendPrivate {
+ gint mail_sync_in_progress;
+ guint mail_sync_timeout_source_id;
+};
+
+static gpointer parent_class;
+static GType anjal_shell_backend_type;
+
+extern gint camel_application_is_exiting;
+
+#include "e-mail-anjal-shared.c"
+
+static void
+anjal_shell_backend_sync_store_done_cb (CamelStore *store,
+ gpointer user_data)
+{
+ AnjalShellBackend *anjal_shell_backend = user_data;
+
+ anjal_shell_backend->priv->mail_sync_in_progress--;
+}
+
+static void
+anjal_shell_backend_sync_store_cb (CamelStore *store,
+ AnjalShellBackend *anjal_shell_backend)
+{
+ if (!camel_application_is_exiting) {
+ anjal_shell_backend->priv->mail_sync_in_progress++;
+ mail_sync_store (
+ store, FALSE,
+ anjal_shell_backend_sync_store_done_cb,
+ anjal_shell_backend);
+ }
+}
+
+static gboolean
+anjal_shell_backend_mail_sync (AnjalShellBackend *anjal_shell_backend)
+{
+ if (camel_application_is_exiting)
+ return FALSE;
+
+ if (anjal_shell_backend->priv->mail_sync_in_progress)
+ goto exit;
+
+ if (session == NULL || !camel_session_is_online (session))
+ goto exit;
+
+ e_mail_store_foreach (
+ (GHFunc) anjal_shell_backend_sync_store_cb,
+ anjal_shell_backend);
+
+exit:
+ return !camel_application_is_exiting;
+}
+
+static void
+anjal_shell_backend_constructed (GObject *object)
+{
+ AnjalShellBackendPrivate *priv;
+ EShell *shell;
+ EShellBackend *shell_backend;
+ char *custom_dir;
+
+ priv = ANJAL_SHELL_BACKEND_GET_PRIVATE (object);
+
+ shell_backend = E_SHELL_BACKEND (object);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ /* This also initializes Camel, so it needs to happen early. */
+ mail_session_init (shell_backend);
+
+ /* Register format types for EMFormatHook. */
+ em_format_hook_register_type (em_format_get_type ());
+ //em_format_hook_register_type (em_format_html_get_type ());
+ //em_format_hook_register_type (em_format_html_display_get_type ());
+
+ /* Register plugin hook types. */
+ em_format_hook_get_type ();
+
+ mail_shell_backend_init_importers ();
+
+ g_signal_connect (
+ shell, "notify::online",
+ G_CALLBACK (mail_shell_backend_notify_online_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "handle-uri",
+ G_CALLBACK (mail_shell_backend_handle_uri_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "prepare-for-offline",
+ G_CALLBACK (mail_shell_backend_prepare_for_offline_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "prepare-for-online",
+ G_CALLBACK (mail_shell_backend_prepare_for_online_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "prepare-for-quit",
+ G_CALLBACK (mail_shell_backend_prepare_for_quit_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "quit-requested",
+ G_CALLBACK (mail_shell_backend_quit_requested_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "send-receive",
+ G_CALLBACK (mail_shell_backend_send_receive_cb),
+ shell_backend);
+
+ g_signal_connect (
+ shell, "window-created",
+ G_CALLBACK (mail_shell_backend_window_created_cb),
+ shell_backend);
+
+ mail_config_init ();
+ mail_msg_init ();
+
+ custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
+ e_mail_store_init (custom_dir);
+ g_free (custom_dir);
+ e_mail_shell_settings_init (shell);
+
+ /* Initialize preferences after the main loop starts so
+ * that all EPlugins and EPluginHooks are loaded first. */
+ g_idle_add ((GSourceFunc) mail_shell_backend_init_preferences, shell);
+}
+
+static void
+anjal_shell_backend_start (EShellBackend *shell_backend)
+{
+ AnjalShellBackendPrivate *priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
+ gboolean enable_search_folders;
+
+ priv = ANJAL_SHELL_BACKEND_GET_PRIVATE (shell_backend);
+
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* XXX Do we really still need this flag? */
+ mail_session_set_interactive (TRUE);
+
+ enable_search_folders = e_shell_settings_get_boolean (
+ shell_settings, "mail-enable-search-folders");
+ if (enable_search_folders)
+ vfolder_load_storage ();
+
+ mail_autoreceive_init (shell_backend, session);
+
+ if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
+ priv->mail_sync_timeout_source_id = g_timeout_add_seconds (
+ mail_config_get_sync_timeout (),
+ (GSourceFunc) anjal_shell_backend_mail_sync,
+ shell_backend);
+}
+
+static void
+anjal_shell_backend_class_init (AnjalShellBackendClass *class)
+{
+ GObjectClass *object_class;
+ EShellBackendClass *shell_backend_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (AnjalShellBackendPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = anjal_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->shell_view_type = ANJAL_TYPE_SHELL_VIEW;
+ shell_backend_class->name = BACKEND_NAME;
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "mailto:email";
+ shell_backend_class->sort_order = 200;
+ shell_backend_class->preferences_page = "mail-accounts";
+ shell_backend_class->start = anjal_shell_backend_start;
+ shell_backend_class->migrate = e_mail_shell_migrate;
+}
+
+static void
+anjal_shell_backend_init (AnjalShellBackend *mail_shell_backend)
+{
+ mail_shell_backend->priv =
+ ANJAL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend);
+}
+
+GType
+anjal_shell_backend_get_type (void)
+{
+ return anjal_shell_backend_type;
+}
+
+void
+anjal_shell_backend_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (AnjalShellBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) anjal_shell_backend_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (AnjalShellBackend),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) anjal_shell_backend_init,
+ NULL /* value_table */
+ };
+
+ anjal_shell_backend_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "AnjalShellBackend", &type_info, 0);
+}
+
diff --git a/modules/mail/anjal-shell-backend.h b/modules/mail/anjal-shell-backend.h
new file mode 100644
index 0000000..1f0a4ad
--- /dev/null
+++ b/modules/mail/anjal-shell-backend.h
@@ -0,0 +1,75 @@
+/*
+ * anjal-shell-backend.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef ANJAL_SHELL_BACKEND_H
+#define ANJAL_SHELL_BACKEND_H
+
+#include <shell/e-shell-backend.h>
+
+#include <camel/camel-folder.h>
+#include <camel/camel-store.h>
+#include <e-util/e-signature-list.h>
+#include <libedataserver/e-account-list.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_BACKEND \
+ (anjal_shell_backend_get_type ())
+#define ANJAL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackend))
+#define ANJAL_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendClass))
+#define E_IS_MAIL_SHELL_BACKEND(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), ANJAL_TYPE_SHELL_BACKEND))
+#define ANJAL_IS_SHELL_BACKEND_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), ANJAL_TYPE_SHELL_BACKEND))
+#define ANJAL_SHELL_BACKEND_GET_CLASS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), ANJAL_TYPE_SHELL_BACKEND, AnjalShellBackendClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellBackend AnjalShellBackend;
+typedef struct _AnjalShellBackendClass AnjalShellBackendClass;
+typedef struct _AnjalShellBackendPrivate AnjalShellBackendPrivate;
+
+struct _AnjalShellBackend {
+ EShellBackend parent;
+ AnjalShellBackendPrivate *priv;
+};
+
+struct _AnjalShellBackendClass {
+ EShellBackendClass parent_class;
+};
+
+GType anjal_shell_backend_get_type (void);
+void anjal_shell_backend_register_type
+ (GTypeModule *type_module);
+
+/* XXX Find a better place for this function. */
+GSList * e_mail_labels_get_filter_options(void);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_BACKEND_H */
diff --git a/modules/mail/anjal-shell-content.c b/modules/mail/anjal-shell-content.c
new file mode 100644
index 0000000..6fcb9cf
--- /dev/null
+++ b/modules/mail/anjal-shell-content.c
@@ -0,0 +1,308 @@
+/*
+ * anjal-shell-content.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "anjal-shell-content.h"
+
+#include <glib/gi18n.h>
+#include <camel/camel-store.h>
+#include <libedataserver/e-data-server-util.h>
+
+#include "e-util/e-binding.h"
+#include "e-util/gconf-bridge.h"
+#include "widgets/misc/e-paned.h"
+
+#include "em-search-context.h"
+#include "em-utils.h"
+#include "mail-config.h"
+#include "mail-ops.h"
+
+#include "e-mail-reader.h"
+#include "e-mail-search-bar.h"
+#include "anjal-shell-backend.h"
+#include "anjal-shell-view-actions.h"
+#include <misc/e-hinted-entry.h>
+
+#define ANJAL_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentPrivate))
+
+#define STATE_KEY_SCROLLBAR_POSITION "ScrollbarPosition"
+#define STATE_KEY_SELECTED_MESSAGE "SelectedMessage"
+
+struct _AnjalShellContentPrivate {
+ GtkWidget *view;
+ GtkWidget *view_box;
+ gboolean show_deleted;
+ GtkWidget *search_entry;
+};
+
+enum {
+ PROP_0,
+ PROP_SHOW_DELETED
+};
+
+static gpointer parent_class;
+static GType anjal_shell_content_type;
+
+
+static void
+anjal_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_DELETED:
+ anjal_shell_content_set_show_deleted (
+ ANJAL_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+anjal_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_DELETED:
+ g_value_set_boolean (
+ value,
+ anjal_shell_content_get_show_deleted (
+ ANJAL_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+anjal_shell_content_dispose (GObject *object)
+{
+ AnjalShellContentPrivate *priv;
+
+ priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+anjal_shell_content_constructed (GObject *object)
+{
+ AnjalShellContentPrivate *priv;
+ EShellContent *shell_content;
+ EShellBackend *shell_backend;
+ EShellView *shell_view;
+ EShellViewClass *shell_view_class;
+ GtkWidget *container;
+
+ priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ shell_content = E_SHELL_CONTENT (object);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ /* Build content widgets. */
+
+ container = GTK_WIDGET (object);
+
+ //widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
+ //gtk_container_add (GTK_CONTAINER (container), widget);
+
+ // Find a way to hook mail-view in here.
+ priv->view_box = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (container), priv->view_box);
+ gtk_widget_show (priv->view_box);
+
+}
+
+void
+anjal_shell_content_pack_view (EShellContent *shell_content, GtkWidget *view)
+{
+ AnjalShellContentPrivate *priv;
+ priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+ gtk_box_pack_start ((GtkBox *)priv->view_box, view, TRUE, TRUE, 0);
+ priv->view = view;
+}
+
+static guint32
+anjal_shell_content_check_state (EShellContent *shell_content)
+{
+ return 0;
+}
+
+static void
+anjal_shell_construct_search_bar (EShellContent *shell_content)
+{
+ GtkWidget *widget = e_hinted_entry_new ();
+ AnjalShellContentPrivate *priv;
+
+ priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+
+ priv->search_entry = widget;
+ e_shell_content_set_search_entry (shell_content, (GtkEntry *)widget, FALSE);
+ e_shell_content_show_search_bar (shell_content, FALSE);
+}
+
+GtkWidget *
+anjal_shell_content_get_search_entry (EShellContent *shell_content)
+{
+ AnjalShellContentPrivate *priv;
+
+ priv = ANJAL_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+ return priv->search_entry;
+}
+
+static void
+anjal_content_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkAllocation child_allocation;
+ GtkWidget *child;
+
+ widget->allocation = *allocation;
+
+ child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
+ child_allocation.width = allocation->width;
+ child_allocation.height = allocation->height;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_size_allocate (child, &child_allocation);
+
+}
+static void
+anjal_shell_content_class_init (AnjalShellContentClass *class)
+{
+ GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (AnjalShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = anjal_shell_content_set_property;
+ object_class->get_property = anjal_shell_content_get_property;
+ object_class->dispose = anjal_shell_content_dispose;
+ object_class->constructed = anjal_shell_content_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->size_allocate = anjal_content_size_allocate;
+
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->new_search_context = em_search_context_new;
+ shell_content_class->check_state = anjal_shell_content_check_state;
+ E_SHELL_CONTENT_CLASS(parent_class)->construct_search_bar = anjal_shell_construct_search_bar;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_DELETED,
+ g_param_spec_boolean (
+ "show-deleted",
+ "Show Deleted",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+}
+
+static void
+anjal_shell_content_init (AnjalShellContent *mail_shell_content)
+{
+ mail_shell_content->priv =
+ ANJAL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+anjal_shell_content_get_type (void)
+{
+ return anjal_shell_content_type;
+}
+
+void
+anjal_shell_content_register_type (GTypeModule *type_module)
+{
+ static const GTypeInfo type_info = {
+ sizeof (AnjalShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) anjal_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (AnjalShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) anjal_shell_content_init,
+ NULL /* value_table */
+ };
+
+ anjal_shell_content_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_CONTENT,
+ "AnjalShellContent", &type_info, 0);
+
+}
+
+GtkWidget *
+anjal_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ ANJAL_TYPE_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+gboolean
+anjal_shell_content_get_show_deleted (AnjalShellContent *mail_shell_content)
+{
+ g_return_val_if_fail (
+ ANJAL_IS_SHELL_CONTENT (mail_shell_content), FALSE);
+
+ return mail_shell_content->priv->show_deleted;
+}
+
+void
+anjal_shell_content_set_show_deleted (AnjalShellContent *mail_shell_content,
+ gboolean show_deleted)
+{
+ g_return_if_fail (ANJAL_IS_SHELL_CONTENT (mail_shell_content));
+
+ mail_shell_content->priv->show_deleted = show_deleted;
+
+ g_object_notify (G_OBJECT (mail_shell_content), "show-deleted");
+}
+
+
diff --git a/modules/mail/anjal-shell-content.h b/modules/mail/anjal-shell-content.h
new file mode 100644
index 0000000..aed1673
--- /dev/null
+++ b/modules/mail/anjal-shell-content.h
@@ -0,0 +1,92 @@
+/*
+ * anjal-shell-content.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef ANJAL_SHELL_CONTENT_H
+#define ANJAL_SHELL_CONTENT_H
+
+#include <shell/e-shell-content.h>
+#include <shell/e-shell-view.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_CONTENT \
+ (anjal_shell_content_get_type ())
+#define ANJAL_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContent))
+#define ANJAL_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentClass))
+#define ANJAL_IS_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), ANJAL_TYPE_SHELL_CONTENT))
+#define ANJAL_IS_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), ANJAL_TYPE_SHELL_CONTENT))
+#define ANJAL_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), ANJAL_TYPE_SHELL_CONTENT, AnjalShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellContent AnjalShellContent;
+typedef struct _AnjalShellContentClass AnjalShellContentClass;
+typedef struct _AnjalShellContentPrivate AnjalShellContentPrivate;
+
+struct _AnjalShellContent {
+ EShellContent parent;
+ AnjalShellContentPrivate *priv;
+};
+
+struct _AnjalShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType anjal_shell_content_get_type (void);
+void anjal_shell_content_register_type
+ (GTypeModule *type_module);
+GtkWidget * anjal_shell_content_new(EShellView *shell_view);
+gboolean anjal_shell_content_get_preview_visible
+ (AnjalShellContent *mail_shell_content);
+void anjal_shell_content_set_preview_visible
+ (AnjalShellContent *mail_shell_content,
+ gboolean preview_visible);
+gboolean anjal_shell_content_get_show_deleted
+ (AnjalShellContent *mail_shell_content);
+void anjal_shell_content_set_show_deleted
+ (AnjalShellContent *mail_shell_content,
+ gboolean show_deleted);
+GalViewInstance *
+ anjal_shell_content_get_view_instance
+ (AnjalShellContent *mail_shell_content);
+void anjal_shell_content_set_search_strings
+ (AnjalShellContent *mail_shell_content,
+ GSList *search_strings);
+void anjal_shell_content_update_view_instance
+ (AnjalShellContent *mail_shell_content);
+GtkWidget * anjal_shell_content_get_search_entry
+ (EShellContent *shell_content);
+void anjal_shell_content_pack_view
+ (EShellContent *shell_content,
+ GtkWidget *view);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_CONTENT_H */
diff --git a/modules/mail/anjal-shell-view-actions.c b/modules/mail/anjal-shell-view-actions.c
new file mode 100644
index 0000000..6c0aa0b
--- /dev/null
+++ b/modules/mail/anjal-shell-view-actions.c
@@ -0,0 +1,875 @@
+/*
+ * anjal-shell-view-actions.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "anjal-shell-view-private.h"
+
+static void
+action_mail_account_disable_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EAccountList *account_list;
+ EAccount *account;
+ gchar *folder_uri;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ g_return_if_fail (folder_uri != NULL);
+
+ account_list = e_get_account_list ();
+ account = mail_config_get_account_by_source_url (folder_uri);
+ g_return_if_fail (account != NULL);
+
+ if (e_account_list_account_has_proxies (account_list, account))
+ e_account_list_remove_account_proxies (account_list, account);
+
+ account->enabled = !account->enabled;
+ e_account_list_change (account_list, account);
+ e_mail_store_remove_by_uri (folder_uri);
+
+ if (account->parent_uid != NULL)
+ e_account_list_remove (account_list, account);
+
+ e_account_list_save (account_list);
+
+ g_free (folder_uri);
+}
+
+
+static void
+action_mail_download_foreach_cb (CamelService *service)
+{
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_prepare_offline (CAMEL_STORE (service));
+}
+
+static void
+action_mail_download_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ e_mail_store_foreach ((GHFunc) action_mail_download_foreach_cb, NULL);
+}
+
+static void
+action_mail_empty_trash_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ em_utils_empty_trash (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_flush_outbox_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ mail_send ();
+}
+
+static void
+action_mail_folder_copy_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ /* XXX Leaking folder_info? */
+ em_folder_utils_copy_folder (
+ GTK_WINDOW (shell_window), folder_info, FALSE);
+}
+
+static void
+action_mail_folder_delete_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ em_folder_utils_delete_folder (folder);
+}
+
+static void
+action_mail_folder_expunge_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+ EMailShellSidebar * mail_shell_sidebar;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ em_utils_expunge_folder (
+ GTK_WIDGET (shell_window), folder);
+}
+
+
+static void
+action_mail_folder_move_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ /* XXX Leaking folder_info? */
+ em_folder_utils_copy_folder (
+ GTK_WINDOW (shell_window), folder_info, TRUE);
+}
+
+static void
+action_mail_folder_new_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EMailShellSidebar *mail_shell_sidebar;
+ CamelFolderInfo *folder_info;
+ EMFolderTree *folder_tree;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder_info = em_folder_tree_get_selected_folder_info (folder_tree);
+ g_return_if_fail (folder_info != NULL);
+
+ em_folder_utils_create_folder (
+ folder_info, folder_tree, GTK_WINDOW (shell_window));
+ camel_folder_info_free (folder_info);
+}
+
+static void
+action_mail_folder_properties_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ EShellView *shell_view;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *uri;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ tree_view = GTK_TREE_VIEW (folder_tree);
+ selection = gtk_tree_view_get_selection (tree_view);
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1);
+ em_folder_properties_show (shell_view, NULL, uri);
+ g_free (uri);
+}
+
+static void
+action_mail_folder_refresh_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ CamelFolder *folder;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ folder = em_folder_tree_get_selected_folder (folder_tree);
+ g_return_if_fail (folder != NULL);
+
+ mail_refresh_folder (folder, NULL, NULL);
+}
+
+static void
+action_mail_folder_rename_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ em_folder_tree_edit_selected (folder_tree);
+}
+
+
+static void
+action_mail_folder_unsubscribe_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ gchar *folder_uri;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+ em_folder_utils_unsubscribe_folder (folder_uri);
+ g_free (folder_uri);
+}
+
+
+static void
+action_mail_search_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ AnjalShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ const gchar *search_hint;
+
+ /* XXX Figure out a way to handle this in EShellContent
+ * instead of every shell view having to handle it.
+ * The problem is EShellContent does not know what
+ * the search option actions are for this view. It
+ * would have to dig up the popup menu and retrieve
+ * the action for each menu item. Seems messy. */
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ search_hint = gtk_action_get_label (GTK_ACTION (current));
+ e_shell_content_set_search_hint (shell_content, search_hint);
+}
+
+static void
+action_mail_stop_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ mail_cancel_all ();
+}
+
+
+static void
+action_mail_tools_filters_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ em_utils_edit_filters (GTK_WIDGET (shell_window));
+}
+
+static void
+action_mail_tools_search_folders_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ vfolder_edit (E_SHELL_VIEW (mail_shell_view));
+}
+
+static void
+action_mail_tools_subscriptions_cb (GtkAction *action,
+ AnjalShellView *mail_shell_view)
+{
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkWidget *dialog;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ dialog = em_subscribe_editor_new ();
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog), GTK_WINDOW (shell_window));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ /* XXX Dialog destroys itself. */
+}
+
+#if 0
+static void
+action_search_filter_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellView *shell_view)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ GKeyFile *key_file;
+ const gchar *folder_uri = NULL;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ key_file = e_shell_view_get_state_key_file (shell_view);
+
+ folder_uri = NULL; /* ANJAL: Get from folder tree */
+
+ if (folder_uri != NULL) {
+ const gchar *key;
+ const gchar *string;
+ gchar *group_name;
+
+ key = STATE_KEY_SEARCH_FILTER;
+ string = gtk_action_get_name (GTK_ACTION (current));
+ group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+ g_key_file_set_string (key_file, group_name, key, string);
+ e_shell_view_set_state_dirty (shell_view);
+
+ g_free (group_name);
+ }
+
+ e_shell_view_execute_search (shell_view);
+}
+#endif
+
+#if 0
+static void
+action_search_scope_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EShellView *shell_view)
+{
+ EShellContent *shell_content;
+ EShellWindow *shell_window;
+ GKeyFile *key_file;
+ const gchar *folder_uri;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ key_file = e_shell_view_get_state_key_file (shell_view);
+
+ folder_uri = NULL; /* ANJAL: Get from folder tree */
+
+ if (folder_uri != NULL) {
+ const gchar *key;
+ const gchar *string;
+ gchar *group_name;
+
+ key = STATE_KEY_SEARCH_SCOPE;
+ string = gtk_action_get_name (GTK_ACTION (current));
+ group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+ g_key_file_set_string (key_file, group_name, key, string);
+ e_shell_view_set_state_dirty (shell_view);
+
+ g_free (group_name);
+ }
+
+ e_shell_view_execute_search (shell_view);
+}
+
+#endif
+static GtkActionEntry mail_entries[] = {
+
+ { "mail-account-disable",
+ NULL,
+ N_("_Disable Account"),
+ NULL,
+ N_("Disable this account"),
+ G_CALLBACK (action_mail_account_disable_cb) },
+
+ { "mail-download",
+ NULL,
+ N_("_Download Messages for Offline Usage"),
+ NULL,
+ N_("Download messages of accounts and folders marked for offline"),
+ G_CALLBACK (action_mail_download_cb) },
+
+ { "mail-empty-trashes", /* this is File->Empty Trash action */
+ NULL,
+ N_("Empty _Trash"),
+ NULL,
+ N_("Permanently remove all the deleted messages from all folders"),
+ G_CALLBACK (action_mail_empty_trash_cb) },
+
+ { "mail-empty-trash", /* this is a popup action over the trash folder */
+ NULL,
+ N_("_Empty Trash"),
+ NULL,
+ N_("Permanently remove all the deleted messages from all folders"),
+ G_CALLBACK (action_mail_empty_trash_cb) },
+
+ { "mail-flush-outbox",
+ "mail-send",
+ N_("Fl_ush Outbox"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_mail_flush_outbox_cb) },
+
+ { "mail-folder-copy",
+ "folder-copy",
+ N_("_Copy Folder To..."),
+ NULL,
+ N_("Copy the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_copy_cb) },
+
+ { "mail-folder-delete",
+ GTK_STOCK_DELETE,
+ NULL,
+ NULL,
+ N_("Permanently remove this folder"),
+ G_CALLBACK (action_mail_folder_delete_cb) },
+
+ { "mail-folder-expunge",
+ NULL,
+ N_("E_xpunge"),
+ "<Control>e",
+ N_("Permanently remove all deleted messages from this folder"),
+ G_CALLBACK (action_mail_folder_expunge_cb) },
+
+ { "mail-folder-move",
+ "folder-move",
+ N_("_Move Folder To..."),
+ NULL,
+ N_("Move the selected folder into another folder"),
+ G_CALLBACK (action_mail_folder_move_cb) },
+
+ { "mail-folder-new",
+ "folder-new",
+ N_("_New..."),
+ NULL,
+ N_("Create a new folder for storing mail"),
+ G_CALLBACK (action_mail_folder_new_cb) },
+
+ { "mail-folder-properties",
+ GTK_STOCK_PROPERTIES,
+ NULL,
+ NULL,
+ N_("Change the properties of this folder"),
+ G_CALLBACK (action_mail_folder_properties_cb) },
+
+ { "mail-folder-refresh",
+ GTK_STOCK_REFRESH,
+ NULL,
+ "F5",
+ N_("Refresh the folder"),
+ G_CALLBACK (action_mail_folder_refresh_cb) },
+
+ { "mail-folder-rename",
+ NULL,
+ N_("_Rename..."),
+ "F2",
+ N_("Change the name of this folder"),
+ G_CALLBACK (action_mail_folder_rename_cb) },
+
+ { "mail-folder-unsubscribe",
+ NULL,
+ N_("_Unsubscribe"),
+ NULL,
+ N_("Unsubscribe from the selected folder"),
+ G_CALLBACK (action_mail_folder_unsubscribe_cb) },
+
+ { "mail-stop",
+ GTK_STOCK_STOP,
+ N_("Cancel"),
+ NULL,
+ N_("Cancel the current mail operation"),
+ G_CALLBACK (action_mail_stop_cb) },
+
+ { "mail-tools-filters",
+ NULL,
+ N_("_Message Filters"),
+ NULL,
+ N_("Create or edit rules for filtering new mail"),
+ G_CALLBACK (action_mail_tools_filters_cb) },
+
+ { "mail-tools-search-folders",
+ NULL,
+ N_("Search F_olders"),
+ NULL,
+ N_("Create or edit search folder definitions"),
+ G_CALLBACK (action_mail_tools_search_folders_cb) },
+
+ { "mail-tools-subscriptions",
+ NULL,
+ N_("_Subscriptions..."),
+ NULL,
+ N_("Subscribe or unsubscribe to folders on remote servers"),
+ G_CALLBACK (action_mail_tools_subscriptions_cb) },
+
+ /*** Menus ***/
+
+ { "mail-folder-menu",
+ NULL,
+ N_("F_older"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-label-menu",
+ NULL,
+ N_("_Label"),
+ NULL,
+ NULL,
+ NULL },
+
+ { "mail-preview-menu",
+ NULL,
+ N_("_Preview"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static EPopupActionEntry mail_popup_entries[] = {
+
+ { "mail-popup-account-disable",
+ NULL,
+ "mail-account-disable" },
+
+ { "mail-popup-empty-trash",
+ NULL,
+ "mail-empty-trash" },
+
+ { "mail-popup-flush-outbox",
+ NULL,
+ "mail-flush-outbox" },
+
+ { "mail-popup-folder-copy",
+ NULL,
+ "mail-folder-copy" },
+
+ { "mail-popup-folder-delete",
+ NULL,
+ "mail-folder-delete" },
+
+ { "mail-popup-folder-move",
+ NULL,
+ "mail-folder-move" },
+
+ { "mail-popup-folder-new",
+ N_("_New Folder..."),
+ "mail-folder-new" },
+
+ { "mail-popup-folder-properties",
+ NULL,
+ "mail-folder-properties" },
+
+ { "mail-popup-folder-refresh",
+ NULL,
+ "mail-folder-refresh" },
+
+ { "mail-popup-folder-rename",
+ NULL,
+ "mail-folder-rename" },
+
+ { "mail-popup-folder-unsubscribe",
+ NULL,
+ "mail-folder-unsubscribe" }
+};
+
+static GtkRadioActionEntry mail_filter_entries[] = {
+
+ { "mail-filter-all-messages",
+ NULL,
+ N_("All Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_ALL_MESSAGES },
+
+ { "mail-filter-important-messages",
+ "emblem-important",
+ N_("Important Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_IMPORTANT_MESSAGES },
+
+ { "mail-filter-last-5-days-messages",
+ NULL,
+ N_("Last 5 Days' Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_LAST_5_DAYS_MESSAGES },
+
+ { "mail-filter-messages-not-junk",
+ "mail-mark-notjunk",
+ N_("Messages Not Junk"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_MESSAGES_NOT_JUNK },
+
+ { "mail-filter-messages-with-attachments",
+ "mail-attachment",
+ N_("Messages with Attachments"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS },
+
+ { "mail-filter-no-label",
+ NULL,
+ N_("No Label"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_NO_LABEL },
+
+ { "mail-filter-read-messages",
+ "mail-read",
+ N_("Read Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_READ_MESSAGES },
+
+ { "mail-filter-recent-messages",
+ NULL,
+ N_("Recent Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_RECENT_MESSAGES },
+
+ { "mail-filter-unread-messages",
+ "mail-unread",
+ N_("Unread Messages"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_FILTER_UNREAD_MESSAGES }
+};
+
+static GtkRadioActionEntry mail_search_entries[] = {
+
+ { "mail-search-body-contains",
+ NULL,
+ N_("Body contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_BODY_CONTAINS },
+
+ { "mail-search-message-contains",
+ NULL,
+ N_("Message contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_MESSAGE_CONTAINS },
+
+ { "mail-search-recipients-contain",
+ NULL,
+ N_("Recipients contain"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_RECIPIENTS_CONTAIN },
+
+ { "mail-search-sender-contains",
+ NULL,
+ N_("Sender contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SENDER_CONTAINS },
+
+ { "mail-search-subject-contains",
+ NULL,
+ N_("Subject contains"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SUBJECT_CONTAINS },
+
+ { "mail-search-subject-or-addresses-contain",
+ NULL,
+ N_("Subject or Addresses contain"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN }
+};
+
+static GtkRadioActionEntry mail_scope_entries[] = {
+
+ { "mail-scope-current-folder",
+ NULL,
+ N_("Current Folder"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ MAIL_SCOPE_CURRENT_FOLDER }
+};
+
+void
+anjal_shell_view_actions_init (AnjalShellView *mail_shell_view)
+{
+ EShellView *shell_view;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+
+ g_return_if_fail (ANJAL_IS_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ /* Mail Actions */
+ action_group = ACTION_GROUP (MAIL);
+ gtk_action_group_add_actions (
+ action_group, mail_entries,
+ G_N_ELEMENTS (mail_entries), mail_shell_view);
+ e_action_group_add_popup_actions (
+ action_group, mail_popup_entries,
+ G_N_ELEMENTS (mail_popup_entries));
+ gtk_action_group_add_radio_actions (
+ action_group, mail_search_entries,
+ G_N_ELEMENTS (mail_search_entries),
+ MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN,
+ G_CALLBACK (action_mail_search_cb), mail_shell_view);
+#if 0
+ gtk_action_group_add_radio_actions (
+ action_group, mail_scope_entries,
+ G_N_ELEMENTS (mail_scope_entries),
+ MAIL_SCOPE_CURRENT_FOLDER,
+ G_CALLBACK (action_search_scope_cb), mail_shell_view);
+#endif
+
+ radio_action = GTK_RADIO_ACTION (ACTION (MAIL_SCOPE_CURRENT_FOLDER));
+ e_shell_content_set_scope_action (shell_content, radio_action);
+ e_shell_content_set_scope_visible (shell_content, FALSE);
+
+}
+
+
+void
+anjal_shell_view_update_popup_labels (AnjalShellView *mail_shell_view)
+{
+
+}
+
+void
+anjal_shell_view_update_search_filter (AnjalShellView *mail_shell_view)
+{
+ EShell *shell;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ EShellWindow *shell_window;
+ EShellView *shell_view;
+ GtkActionGroup *action_group;
+ GtkRadioAction *radio_action;
+ GtkTreeModel *tree_model;
+ GtkTreeIter iter;
+ GList *list;
+ GSList *group;
+ gboolean valid;
+ gint ii = 0;
+
+ g_return_if_fail (ANJAL_IS_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ action_group = ACTION_GROUP (MAIL_FILTER);
+ e_action_group_remove_all_actions (action_group);
+
+ /* Add the standard filter actions. */
+#if 0
+ gtk_action_group_add_radio_actions (
+ action_group, mail_filter_entries,
+ G_N_ELEMENTS (mail_filter_entries),
+ MAIL_FILTER_ALL_MESSAGES,
+ G_CALLBACK (action_search_filter_cb),
+ mail_shell_view);
+#endif
+ /* Retrieve the radio group from an action we just added. */
+ list = gtk_action_group_list_actions (action_group);
+ radio_action = GTK_RADIO_ACTION (list->data);
+ group = gtk_radio_action_get_group (radio_action);
+ g_list_free (list);
+
+ valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+
+ while (valid) {
+ GtkAction *action;
+ gchar *action_name;
+ gchar *stock_id;
+ gchar *label;
+
+ label = e_mail_label_list_store_get_name (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ stock_id = e_mail_label_list_store_get_stock_id (
+ E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+
+ action_name = g_strdup_printf ("mail-filter-label-%d", ii);
+ radio_action = gtk_radio_action_new (
+ action_name, label, NULL, stock_id, ii);
+ g_free (action_name);
+
+ gtk_radio_action_set_group (radio_action, group);
+ group = gtk_radio_action_get_group (radio_action);
+
+ /* The action group takes ownership of the action. */
+ action = GTK_ACTION (radio_action);
+ gtk_action_group_add_action (action_group, action);
+ g_object_unref (radio_action);
+
+ g_free (label);
+ g_free (stock_id);
+
+ valid = gtk_tree_model_iter_next (tree_model, &iter);
+ ii++;
+ }
+#if 0
+ /* Use any action in the group; doesn't matter which. */
+ e_shell_content_set_filter_action (shell_content, radio_action);
+
+ ii = MAIL_FILTER_UNREAD_MESSAGES;
+ e_shell_content_add_filter_separator_after (shell_content, ii);
+
+ ii = MAIL_FILTER_READ_MESSAGES;
+ e_shell_content_add_filter_separator_before (shell_content, ii);
+#endif
+ g_object_unref (tree_model);
+}
diff --git a/modules/mail/anjal-shell-view-actions.h b/modules/mail/anjal-shell-view-actions.h
new file mode 100644
index 0000000..c992017
--- /dev/null
+++ b/modules/mail/anjal-shell-view-actions.h
@@ -0,0 +1,257 @@
+/*
+ * anjal-shell-view-actions.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef ANJAL_SHELL_VIEW_ACTIONS_H
+#define ANJAL_SHELL_VIEW_ACTIONS_H
+
+#include <shell/e-shell-window-actions.h>
+
+/* Mail Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_ACCOUNT_DISABLE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-account-disable")
+#define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-add-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-caret-mode")
+#define E_SHELL_WINDOW_ACTION_MAIL_CHECK_FOR_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-check-for-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_CLIPBOARD_COPY(window) \
+ E_SHELL_WINDOw_ACTION ((window), "mail-clipboard-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_CREATE_SEARCH_FOLDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-create-search-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_DOWNLOAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-download")
+#define E_SHELL_WINDOW_ACTION_MAIL_EMPTY_TRASH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-empty-trash")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_MAILING_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_RECIPIENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SUBJECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTERS_APPLY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filters-apply")
+#define E_SHELL_WINDOW_ACTION_MAIL_FIND(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-find")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_CLEAR(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-clear")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_COMPLETED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-completed")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_FOR_FOLLOWUP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flag-for-followup")
+#define E_SHELL_WINDOW_ACTION_MAIL_FLUSH_OUTBOX(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-flush-outbox")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_COPY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-copy")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_DELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-delete")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_EXPUNGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-expunge")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MARK_ALL_AS_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-mark-all-as-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_PROPERTIES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-properties")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_REFRESH(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-refresh")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_RENAME(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-rename")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_THREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_SUBTHREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-subthread")
+#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_UNSUBSCRIBE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-folder-unsubscribe")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_ATTACHED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-attached")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_INLINE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline")
+#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-label-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NONE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-label-none")
+#define E_SHELL_WINDOW_ACTION_MAIL_LOAD_IMAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-load-images")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_NOTJUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-notjunk")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_READ(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-read")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNIMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-unimportant")
+#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-mark-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_EDIT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-edit")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-new")
+#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_OPEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-message-open")
+#define E_SHELL_WINDOW_ACTION_MAIL_MOVE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-move")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_THREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-thread")
+#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-next-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_IMPORTANT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous-important")
+#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_UNREAD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-previous-unread")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-print")
+#define E_SHELL_WINDOW_ACTION_MAIL_PRINT_PREVIEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-print-preview")
+#define E_SHELL_WINDOW_ACTION_MAIL_REDIRECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-redirect")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-reply-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_MAILING_LIST(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-mailing-list")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_RECIPIENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-recipients")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SENDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-sender")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SUBJECT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-subject")
+#define E_SHELL_WINDOW_ACTION_MAIL_SELECT_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-select-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden")
+#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-smart-backward")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_FORWARD(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-smart-forward")
+#define E_SHELL_WINDOW_ACTION_MAIL_STOP(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-stop")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_COLLAPSE_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-collapse-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_EXPAND_ALL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-expand-all")
+#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_GROUP_BY(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-threads-group-by")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_FILTERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-filters")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SEARCH_FOLDERS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-search-folders")
+#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SUBSCRIPTIONS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions")
+#define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-undelete")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_CLASSIC(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-view-classic")
+#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_VERTICAL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-view-vertical")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_100(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-100")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_IN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-in")
+#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_OUT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-zoom-out")
+
+/* Mail Query Actions */
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ALL_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-all-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_IMPORTANT_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-important-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LAST_5_DAYS_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-last-5-days-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_NOT_JUNK(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-not-junk")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-with-attachments")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_NO_LABEL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-no-label")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_READ_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-read-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_RECENT_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-recent-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_UNREAD_MESSAGES(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-filter-unread-messages")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_ALL_ACCOUNTS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-all-accounts")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_ACCOUNT(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-account")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_FOLDER(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-folder")
+#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_MESSAGE(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-message")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_BODY_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-body-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_MESSAGE_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-message-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_RECIPIENTS_CONTAIN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-recipients-contain")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SENDER_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-sender-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_CONTAINS(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-contains")
+#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN(window) \
+ E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-addresses-contain")
+
+/* Action Groups */
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_FILTER(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-filter")
+#define E_SHELL_WINDOW_ACTION_GROUP_MAIL_LABEL(window) \
+ E_SHELL_WINDOW_ACTION_GROUP ((window), "mail-label")
+
+#endif /* ANJAL_SHELL_VIEW_ACTIONS_H */
diff --git a/modules/mail/anjal-shell-view-private.c b/modules/mail/anjal-shell-view-private.c
new file mode 100644
index 0000000..252f3b5
--- /dev/null
+++ b/modules/mail/anjal-shell-view-private.c
@@ -0,0 +1,292 @@
+/*
+ * e-mail-shell-view-private.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "anjal-shell-view-private.h"
+
+static void
+mail_shell_view_folder_tree_selected_cb (AnjalShellView *mail_shell_view,
+ const gchar *full_name,
+ const gchar *uri,
+ guint32 flags,
+ EMFolderTree *folder_tree)
+{
+ EShellView *shell_view;
+ gboolean folder_selected;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+
+ folder_selected =
+ !(flags & CAMEL_FOLDER_NOSELECT) &&
+ full_name != NULL;
+
+ anjal_mail_view_set_folder_uri (mail_shell_view->priv->view, uri);
+ e_shell_view_update_actions (shell_view);
+}
+
+static gboolean
+mail_shell_view_folder_tree_key_press_event_cb (AnjalShellView *mail_shell_view,
+ GdkEventKey *event)
+{
+ gboolean handled = FALSE;
+
+ if ((event->state & GDK_CONTROL_MASK) != 0)
+ goto ctrl;
+
+ /* <keyval> alone */
+ switch (event->keyval) {
+ case GDK_period:
+ case GDK_comma:
+ case GDK_bracketleft:
+ case GDK_bracketright:
+ goto emit;
+
+ default:
+ goto exit;
+ }
+
+ctrl:
+ /* Ctrl + <keyval> */
+ switch (event->keyval) {
+ case GDK_period:
+ case GDK_comma:
+ goto emit;
+
+ default:
+ goto exit;
+ }
+
+ /* All branches jump past this. */
+ g_return_val_if_reached (FALSE);
+
+emit:
+ /* Forward the key press to the EMailReader interface. */
+ ;
+exit:
+ return handled;
+}
+
+static void
+mail_shell_view_folder_tree_selection_done_cb (AnjalShellView *mail_shell_view,
+ GtkWidget *menu)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ const gchar *list_uri=NULL;
+ gchar *tree_uri;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ tree_uri = em_folder_tree_get_selected_uri (folder_tree);
+
+ /* If the folder tree and message list disagree on the current
+ * folder, reset the folder tree to match the message list. */
+ if (g_strcmp0 (tree_uri, list_uri) != 0)
+ em_folder_tree_set_selected (folder_tree, list_uri, FALSE);
+
+ g_free (tree_uri);
+
+ /* Disconnect from the "selection-done" signal. */
+ g_signal_handlers_disconnect_by_func (
+ menu, mail_shell_view_folder_tree_selection_done_cb,
+ mail_shell_view);
+}
+
+static void
+mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
+ GdkEventButton *event)
+{
+ GtkWidget *menu;
+ const gchar *widget_path;
+
+ widget_path = "/mail-folder-popup";
+ menu = e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ g_signal_connect_swapped (
+ menu, "selection-done",
+ G_CALLBACK (mail_shell_view_folder_tree_selection_done_cb),
+ shell_view);
+}
+
+void
+anjal_shell_view_set_mail_view (AnjalShellView *mail_shell_view,
+ AnjalMailView *mail_view)
+{
+ AnjalShellViewPrivate *priv = mail_shell_view->priv;
+ EShellView *shell_view;
+ EShellSidebar *shell_sidebar;
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+
+ priv->view = mail_view;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ anjal_mail_view_set_folder_tree (mail_shell_view->priv->view, (GtkWidget *)folder_tree);
+}
+
+void
+anjal_shell_view_private_init (AnjalShellView *mail_shell_view,
+ EShellViewClass *shell_view_class)
+{
+
+}
+
+void
+anjal_shell_view_private_constructed (AnjalShellView *mail_shell_view)
+{
+ AnjalShellViewPrivate *priv = mail_shell_view->priv;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShell *shell;
+ EShellView *shell_view;
+ EShellBackend *shell_backend;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EMFolderTree *folder_tree;
+ ERuleContext *context;
+ EFilterRule *rule = NULL;
+ GtkTreeSelection *selection;
+ GtkTreeModel *tree_model;
+ GtkUIManager *ui_manager;
+ const gchar *source;
+ guint merge_id;
+ gint ii = 0;
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ tree_model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ e_shell_window_add_action_group (shell_window, "mail");
+ e_shell_window_add_action_group (shell_window, "mail-filter");
+ e_shell_window_add_action_group (shell_window, "mail-label");
+
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ priv->label_merge_id = merge_id;
+
+ /* Cache these to avoid lots of awkward casting. */
+ priv->mail_shell_backend = g_object_ref (shell_backend);
+ priv->mail_shell_content = g_object_ref (shell_content);
+ priv->mail_shell_sidebar = g_object_ref (shell_sidebar);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
+
+ g_signal_connect_swapped (
+ folder_tree, "folder-selected",
+ G_CALLBACK (mail_shell_view_folder_tree_selected_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ folder_tree, "key-press-event",
+ G_CALLBACK (mail_shell_view_folder_tree_key_press_event_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ folder_tree, "popup-event",
+ G_CALLBACK (mail_shell_view_folder_tree_popup_event_cb),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-changed",
+ G_CALLBACK (anjal_shell_view_update_search_filter),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-deleted",
+ G_CALLBACK (anjal_shell_view_update_search_filter),
+ mail_shell_view);
+
+ g_signal_connect_swapped (
+ tree_model, "row-inserted",
+ G_CALLBACK (anjal_shell_view_update_search_filter),
+ mail_shell_view);
+
+ anjal_shell_view_actions_init (mail_shell_view);
+ anjal_shell_view_update_search_filter (mail_shell_view);
+
+ /* Populate built-in rules for search entry popup menu.
+ * Keep the assertions, please. If the conditions aren't
+ * met we're going to crash anyway, just more mysteriously. */
+ context = e_shell_content_get_search_context (shell_content);
+ source = E_FILTER_SOURCE_DEMAND;
+ while ((rule = e_rule_context_next_rule (context, rule, source))) {
+ g_assert (ii < MAIL_NUM_SEARCH_RULES);
+ priv->search_rules[ii++] = g_object_ref (rule);
+ }
+ g_assert (ii == MAIL_NUM_SEARCH_RULES);
+
+ /* Now that we're all set up, simulate selecting a folder. */
+ g_signal_emit_by_name (selection, "changed");
+}
+
+void
+anjal_shell_view_private_dispose (AnjalShellView *mail_shell_view)
+{
+ AnjalShellViewPrivate *priv = mail_shell_view->priv;
+ gint ii;
+
+ DISPOSE (priv->mail_shell_backend);
+ DISPOSE (priv->mail_shell_content);
+ DISPOSE (priv->mail_shell_sidebar);
+
+ for (ii = 0; ii < MAIL_NUM_SEARCH_RULES; ii++)
+ DISPOSE (priv->search_rules[ii]);
+}
+
+void
+anjal_shell_view_private_finalize (AnjalShellView *mail_shell_view)
+{
+ /* XXX Nothing to do? */
+}
+
+void
+anjal_shell_view_restore_state (AnjalShellView *mail_shell_view, const char *folder_uri)
+{
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ gchar *group_name;
+
+ /* XXX Move this to EMailShellContent. */
+
+ g_return_if_fail (E_IS_SHELL_VIEW (mail_shell_view));
+
+ shell_view = E_SHELL_VIEW (mail_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ group_name = g_strdup_printf ("Folder %s", folder_uri);
+ e_shell_content_restore_state (shell_content, group_name);
+ g_free (group_name);
+}
+
diff --git a/modules/mail/anjal-shell-view-private.h b/modules/mail/anjal-shell-view-private.h
new file mode 100644
index 0000000..47b17e5
--- /dev/null
+++ b/modules/mail/anjal-shell-view-private.h
@@ -0,0 +1,181 @@
+/*
+ * anjal-shell-view-private.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef ANJAL_SHELL_VIEW_PRIVATE_H
+#define ANJAL_SHELL_VIEW_PRIVATE_H
+
+#include "anjal-shell-view.h"
+#include "anjal-mail-view.h"
+
+#include <glib/gi18n.h>
+#include <gtkhtml/gtkhtml.h>
+#include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
+#include <camel/camel-vtrash-folder.h>
+#include <camel/camel-search-private.h> /* for camel_search_word */
+
+#include "e-util/e-util.h"
+#include "e-util/e-binding.h"
+#include "e-util/gconf-bridge.h"
+#include "e-util/e-account-utils.h"
+#include "filter/e-filter-part.h"
+#include "widgets/misc/e-web-view.h"
+#include "widgets/misc/e-popup-action.h"
+#include "widgets/menus/gal-view-instance.h"
+
+#include "e-mail-label-action.h"
+#include "e-mail-label-dialog.h"
+#include "e-mail-label-list-store.h"
+#include "e-mail-local.h"
+#include "e-mail-reader.h"
+#include "e-mail-store.h"
+#include "em-composer-utils.h"
+#include "em-folder-properties.h"
+#include "em-folder-selector.h"
+#include "em-folder-utils.h"
+#include "em-subscribe-editor.h"
+#include "em-utils.h"
+#include "mail-autofilter.h"
+#include "mail-config.h"
+#include "mail-ops.h"
+#include "mail-send-recv.h"
+#include "mail-vfolder.h"
+
+#include "anjal-shell-backend.h"
+#include "anjal-shell-content.h"
+#include "e-mail-shell-sidebar.h"
+#include "anjal-shell-view-actions.h"
+
+#define ANJAL_SHELL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewPrivate))
+
+/* Shorthand, requires a variable named "shell_window". */
+#define ACTION(name) \
+ (E_SHELL_WINDOW_ACTION_##name (shell_window))
+#define ACTION_GROUP(name) \
+ (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))
+
+/* For use in dispose() methods. */
+#define DISPOSE(obj) \
+ G_STMT_START { \
+ if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
+ } G_STMT_END
+
+/* ETable Specifications */
+#define ETSPEC_FILENAME "message-list.etspec"
+
+/* State File Keys */
+#define STATE_KEY_SEARCH_FILTER "SearchFilter"
+#define STATE_KEY_SEARCH_SCOPE "SearchScope"
+#define STATE_KEY_SEARCH_TEXT "SearchText"
+
+G_BEGIN_DECLS
+
+/* Filter items are displayed in ascending order.
+ * Labels are numbered from zero, so subsequent items must have
+ * sufficiently large values. Unfortunately this introduces an
+ * arbitrary upper bound on labels. */
+enum {
+ MAIL_FILTER_ALL_MESSAGES = -3,
+ MAIL_FILTER_UNREAD_MESSAGES = -2,
+ MAIL_FILTER_NO_LABEL = -1,
+ /* Labels go here */
+ MAIL_FILTER_READ_MESSAGES = 5000,
+ MAIL_FILTER_RECENT_MESSAGES = 5001,
+ MAIL_FILTER_LAST_5_DAYS_MESSAGES = 5002,
+ MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS = 5003,
+ MAIL_FILTER_IMPORTANT_MESSAGES = 5004,
+ MAIL_FILTER_MESSAGES_NOT_JUNK = 5005
+};
+
+/* Search items are displayed in ascending order. */
+enum {
+ MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN,
+ MAIL_SEARCH_RECIPIENTS_CONTAIN,
+ MAIL_SEARCH_MESSAGE_CONTAINS,
+ MAIL_SEARCH_SUBJECT_CONTAINS,
+ MAIL_SEARCH_SENDER_CONTAINS,
+ MAIL_SEARCH_BODY_CONTAINS,
+ MAIL_NUM_SEARCH_RULES
+};
+
+/* Scope items are displayed in ascending order. */
+enum {
+ MAIL_SCOPE_CURRENT_FOLDER,
+ MAIL_SCOPE_CURRENT_ACCOUNT,
+ MAIL_SCOPE_ALL_ACCOUNTS
+};
+
+struct _AnjalShellViewPrivate {
+
+ /*** Other Stuff ***/
+
+ /* These are just for convenience. */
+ AnjalShellBackend *mail_shell_backend;
+ AnjalShellContent *mail_shell_content;
+ EMailShellSidebar *mail_shell_sidebar;
+
+ /* For UI merging and unmerging. */
+ guint merge_id;
+ guint label_merge_id;
+
+ /* Filter rules correspond to the search entry menu. */
+ EFilterRule *search_rules[MAIL_NUM_SEARCH_RULES];
+
+ guint show_deleted : 1;
+
+ AnjalMailView *view;
+};
+
+void anjal_shell_view_private_init
+ (AnjalShellView *mail_shell_view,
+ EShellViewClass *shell_view_class);
+void anjal_shell_view_private_constructed
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_private_dispose
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_private_finalize
+ (AnjalShellView *mail_shell_view);
+
+/* Private Utilities */
+
+void anjal_shell_view_actions_init
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_restore_state
+ (AnjalShellView *mail_shell_view,
+ const char *uri);
+void anjal_shell_view_create_filter_from_selected
+ (AnjalShellView *mail_shell_view,
+ gint filter_type);
+void anjal_shell_view_create_vfolder_from_selected
+ (AnjalShellView *mail_shell_view,
+ gint vfolder_type);
+void anjal_shell_view_update_popup_labels
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_update_search_filter
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_update_sidebar
+ (AnjalShellView *mail_shell_view);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_VIEW_PRIVATE_H */
diff --git a/modules/mail/anjal-shell-view.c b/modules/mail/anjal-shell-view.c
new file mode 100644
index 0000000..7762cf0
--- /dev/null
+++ b/modules/mail/anjal-shell-view.c
@@ -0,0 +1,609 @@
+/*
+ * anjal-shell-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "anjal-shell-view-private.h"
+
+static gpointer parent_class;
+static GType anjal_shell_view_type;
+
+static void
+anjal_shell_view_dispose (GObject *object)
+{
+ anjal_shell_view_private_dispose (ANJAL_SHELL_VIEW (object));
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+anjal_shell_view_finalize (GObject *object)
+{
+ anjal_shell_view_private_finalize (ANJAL_SHELL_VIEW (object));
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+anjal_shell_view_constructed (GObject *object)
+{
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ anjal_shell_view_private_constructed (ANJAL_SHELL_VIEW (object));
+}
+
+static void
+anjal_shell_view_toggled (EShellView *shell_view)
+{
+ AnjalShellViewPrivate *priv;
+
+ priv = ANJAL_SHELL_VIEW_GET_PRIVATE(shell_view);
+
+ /* Chain up to parent's toggled() method. */
+ E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view);
+}
+
+static void
+anjal_shell_view_execute_search (EShellView *shell_view)
+{
+ AnjalShellViewPrivate *priv;
+ EShell *shell;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ EShellSettings *shell_settings;
+ AnjalShellContent *mail_shell_content;
+ EFilterRule *rule;
+ EFilterRule *search_rule;
+ GtkAction *action;
+ GtkTreeModel *model;
+ GString *string;
+ GList *iter;
+ GSList *search_strings = NULL;
+ const gchar *folder_uri;
+ const gchar *text;
+ gchar *query;
+ gchar *temp;
+ gint value;
+ AnjalShellView *anjal_shell_view = (AnjalShellView *)shell_view;
+ EShellSidebar *shell_sidebar;
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+
+ mail_shell_sidebar = anjal_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ folder_uri = em_folder_tree_get_selected_uri (folder_tree);
+
+ priv = ANJAL_SHELL_VIEW_GET_PRIVATE (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ shell = e_shell_window_get_shell (shell_window);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ mail_shell_content = ANJAL_SHELL_CONTENT (shell_content);
+
+ if (folder_uri != NULL) {
+ GKeyFile *key_file;
+ const gchar *key;
+ const gchar *string;
+ gchar *group_name;
+
+ key_file = e_shell_view_get_state_key_file (shell_view);
+
+ key = STATE_KEY_SEARCH_TEXT;
+ string = e_shell_content_get_search_text (shell_content);
+ group_name = g_strdup_printf ("Folder %s", folder_uri);
+
+ if (string != NULL && *string != '\0')
+ g_key_file_set_string (
+ key_file, group_name, key, string);
+ else
+ g_key_file_remove_key (
+ key_file, group_name, key, NULL);
+ e_shell_view_set_state_dirty (shell_view);
+ printf("SAVE %s %s\n", group_name, string ? string : NULL);
+ g_free (group_name);
+ } else
+ printf ("NOTHING \n");
+
+ /* This returns a new object reference. */
+ model = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ text = e_shell_content_get_search_text (shell_content);
+ if (text == NULL || *text == '\0') {
+ query = g_strdup ("");
+ goto filter;
+ }
+
+ /* Replace variables in the selected rule with the
+ * current search text and extract a query string. */
+
+ action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN);
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+ g_return_if_fail (value >= 0 && value < MAIL_NUM_SEARCH_RULES);
+ rule = priv->search_rules[value];
+
+ for (iter = rule->parts; iter != NULL; iter = iter->next) {
+ EFilterPart *part = iter->data;
+ EFilterElement *element = NULL;
+
+ if (strcmp (part->name, "subject") == 0)
+ element = e_filter_part_find_element (part, "subject");
+ else if (strcmp (part->name, "body") == 0)
+ element = e_filter_part_find_element (part, "word");
+ else if (strcmp (part->name, "sender") == 0)
+ element = e_filter_part_find_element (part, "sender");
+ else if (strcmp (part->name, "to") == 0)
+ element = e_filter_part_find_element (part, "recipient");
+
+ if (strcmp (part->name, "body") == 0) {
+ struct _camel_search_words *words;
+ gint ii;
+
+ words = camel_search_words_split ((guchar *) text);
+ for (ii = 0; ii < words->len; ii++)
+ search_strings = g_slist_prepend (
+ search_strings, g_strdup (
+ words->words[ii]->word));
+ camel_search_words_free (words);
+ }
+
+ if (element != NULL) {
+ EFilterInput *input = E_FILTER_INPUT (element);
+ e_filter_input_set_value (input, text);
+ }
+ }
+
+ string = g_string_sized_new (1024);
+ e_filter_rule_build_code (rule, string);
+ query = g_string_free (string, FALSE);
+
+filter:
+#if 0
+ /* Apply selected filter. */
+
+ value = e_shell_content_get_filter_value (shell_content);
+ switch (value) {
+ case MAIL_FILTER_ALL_MESSAGES:
+ break;
+
+ case MAIL_FILTER_UNREAD_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all (not "
+ "(system-flag \"Seen\"))))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_NO_LABEL:
+ string = g_string_sized_new (1024);
+ g_string_append_printf (
+ string, "(and %s (and ", query);
+ valid = gtk_tree_model_get_iter_first (
+ model, &tree_iter);
+ while (valid) {
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (model),
+ &tree_iter);
+ g_string_append_printf (
+ string, " (match-all (not (or "
+ "(= (user-tag \"label\") \"%s\") "
+ "(user-flag \"$Label%s\") "
+ "(user-flag \"%s\"))))",
+ tag, tag, tag);
+ g_free (tag);
+
+ valid = gtk_tree_model_iter_next (
+ model, &tree_iter);
+ }
+ g_string_append_len (string, "))", 2);
+ g_free (query);
+ query = g_string_free (string, FALSE);
+ break;
+
+ case MAIL_FILTER_READ_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Seen\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_RECENT_MESSAGES:
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-sent-date) "
+ "(- (get-current-date) 86400))))",
+ query);
+ else
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-received-date) "
+ "(- (get-current-date) 86400))))",
+ query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-sent-date) "
+ "(- (get-current-date) 432000))))",
+ query);
+ else
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(> (get-received-date) "
+ "(- (get-current-date) 432000))))",
+ query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Attachments\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_IMPORTANT_MESSAGES:
+ temp = g_strdup_printf (
+ "(and %s (match-all "
+ "(system-flag \"Flagged\")))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ case MAIL_FILTER_MESSAGES_NOT_JUNK:
+ temp = g_strdup_printf (
+ "(and %s (match-all (not "
+ "(system-flag \"junk\"))))", query);
+ g_free (query);
+ query = temp;
+ break;
+
+ default:
+ /* The action value also serves as a path for
+ * the label list store. That's why we number
+ * the label actions from zero. */
+ path = gtk_tree_path_new_from_indices (value, -1);
+ gtk_tree_model_get_iter (model, &tree_iter, path);
+ gtk_tree_path_free (path);
+
+ tag = e_mail_label_list_store_get_tag (
+ E_MAIL_LABEL_LIST_STORE (model), &tree_iter);
+ temp = g_strdup_printf (
+ "(and %s (match-all (or "
+ "(= (user-tag \"label\") \"%s\") "
+ "(user-flag \"$Label%s\") "
+ "(user-flag \"%s\"))))",
+ query, tag, tag, tag);
+ g_free (tag);
+
+ g_free (query);
+ query = temp;
+ break;
+ }
+#endif
+
+ search_rule = e_shell_content_get_search_rule (shell_content);
+ if (search_rule != NULL) {
+ string = g_string_sized_new (1024);
+ e_filter_rule_build_code (search_rule, string);
+ temp = g_strconcat ("(and", string->str, query, ")", NULL);
+
+ g_free (query);
+ query = temp;
+
+ g_string_free (string, TRUE);
+ }
+
+ if (anjal_shell_view->priv->view)
+ anjal_mail_view_set_search (anjal_shell_view->priv->view, query);
+
+ g_slist_foreach (search_strings, (GFunc) g_free, NULL);
+ g_slist_free (search_strings);
+
+ g_object_unref (model);
+ g_free (query);
+}
+
+static void
+has_unread_mail (GtkTreeModel *model, GtkTreeIter *parent, gboolean is_root, gboolean *has_unread)
+{
+ guint unread = 0;
+ GtkTreeIter iter, child;
+
+ g_return_if_fail (model != NULL);
+ g_return_if_fail (parent != NULL);
+ g_return_if_fail (has_unread != NULL);
+
+ if (is_root) {
+ gboolean is_store = FALSE, is_draft = FALSE;
+
+ gtk_tree_model_get (model, parent,
+ COL_UINT_UNREAD, &unread,
+ COL_BOOL_IS_STORE, &is_store,
+ COL_BOOL_IS_DRAFT, &is_draft,
+ -1);
+
+ if (is_draft || is_store) {
+ *has_unread = FALSE;
+ return;
+ }
+
+ *has_unread = *has_unread || (unread > 0 && unread != ~((guint)0));
+
+ if (*has_unread)
+ return;
+
+ if (!gtk_tree_model_iter_children (model, &iter, parent))
+ return;
+ } else {
+ iter = *parent;
+ }
+
+ do {
+ gtk_tree_model_get (model, &iter, COL_UINT_UNREAD, &unread, -1);
+
+ *has_unread = *has_unread || (unread > 0 && unread != ~((guint)0));
+ if (*has_unread)
+ break;
+
+ if (gtk_tree_model_iter_children (model, &child, &iter))
+ has_unread_mail (model, &child, FALSE, has_unread);
+
+ } while (gtk_tree_model_iter_next (model, &iter) && !*has_unread);
+}
+
+static void
+anjal_shell_view_update_actions (EShellView *shell_view)
+{
+ AnjalShellView *mail_shell_view;
+ AnjalShellContent *mail_shell_content;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EShellWindow *shell_window;
+ EMFolderTree *folder_tree;
+ EAccount *account = NULL;
+ GtkAction *action;
+ const gchar *label;
+ gchar *uri;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean account_is_groupwise = FALSE;
+ gboolean folder_allows_children;
+ gboolean folder_can_be_deleted;
+ gboolean folder_is_junk;
+ gboolean folder_is_outbox;
+ gboolean folder_is_store;
+ gboolean folder_is_trash;
+ gboolean folder_has_unread_rec = FALSE;
+ gboolean folder_tree_and_message_list_agree = TRUE;
+
+ mail_shell_view = ANJAL_SHELL_VIEW (shell_view);
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ state = e_shell_sidebar_check_state (shell_sidebar);
+
+ folder_allows_children =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_ALLOWS_CHILDREN);
+ folder_can_be_deleted =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_CAN_DELETE);
+ folder_is_junk =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_JUNK);
+ folder_is_outbox =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_OUTBOX);
+ folder_is_store =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_STORE);
+ folder_is_trash =
+ (state & E_MAIL_SHELL_SIDEBAR_FOLDER_IS_TRASH);
+
+ uri = em_folder_tree_get_selected_uri (folder_tree);
+ if (uri != NULL) {
+ EMFolderTreeModel *model;
+
+ /* XXX If the user right-clicks on a folder other than what
+ * the message list is showing, disable folder rename.
+ * Between fetching the CamelFolder asynchronously and
+ * knowing when NOT to move the folder tree selection
+ * back to where it was to avoid cancelling the inline
+ * folder tree editing, it's just too hairy to try to
+ * get right. So we're punting. */
+
+ account = mail_config_get_account_by_source_url (uri);
+
+ /* FIXME This belongs in a GroupWise plugin. */
+ account_is_groupwise =
+ (g_strrstr (uri, "groupwise://") != NULL) &&
+ account != NULL && account->parent_uid != NULL;
+
+ model = em_folder_tree_model_get_default ();
+ if (model) {
+ GtkTreeRowReference *reference = em_folder_tree_model_lookup_uri (model, uri);
+ if (reference != NULL) {
+ GtkTreePath *path = gtk_tree_row_reference_get_path (reference);
+ GtkTreeIter iter;
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
+ has_unread_mail (GTK_TREE_MODEL (model), &iter, TRUE, &folder_has_unread_rec);
+ gtk_tree_path_free (path);
+ }
+ }
+
+ g_free (uri);
+ }
+
+ action = ACTION (MAIL_ACCOUNT_DISABLE);
+ sensitive = (account != NULL) && folder_is_store;
+ if (account_is_groupwise)
+ label = _("Proxy _Logout");
+ else
+ label = _("_Disable Account");
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "label", label, NULL);
+
+ action = ACTION (MAIL_EMPTY_TRASH);
+ sensitive = folder_is_trash;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FLUSH_OUTBOX);
+ sensitive = folder_is_outbox;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_COPY);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_DELETE);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_MOVE);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_NEW);
+ sensitive = folder_allows_children;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_PROPERTIES);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_REFRESH);
+ sensitive = !folder_is_store;
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_RENAME);
+ sensitive =
+ !folder_is_store && folder_can_be_deleted &&
+ folder_tree_and_message_list_agree;
+ gtk_action_set_sensitive (action, sensitive);
+
+// action = ACTION (MAIL_FOLDER_SELECT_ALL);
+// sensitive = !folder_is_store;
+// gtk_action_set_sensitive (action, sensitive);
+
+// action = ACTION (MAIL_FOLDER_SELECT_THREAD);
+// sensitive = !folder_is_store;
+// gtk_action_set_sensitive (action, sensitive);
+
+// action = ACTION (MAIL_FOLDER_SELECT_SUBTHREAD);
+// sensitive = !folder_is_store;
+// gtk_action_set_sensitive (action, sensitive);
+
+ action = ACTION (MAIL_FOLDER_UNSUBSCRIBE);
+ sensitive = !folder_is_store && folder_can_be_deleted;
+ gtk_action_set_sensitive (action, sensitive);
+
+// action = ACTION (MAIL_FOLDER_MARK_ALL_AS_READ);
+// sensitive = folder_has_unread_rec && !folder_is_store;
+// gtk_action_set_sensitive (action, sensitive);
+
+ anjal_shell_view_update_popup_labels (mail_shell_view);
+}
+
+static void
+anjal_shell_view_class_init (AnjalShellViewClass *class,
+ GTypeModule *type_module)
+{
+ GObjectClass *object_class;
+ EShellViewClass *shell_view_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (AnjalShellViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = anjal_shell_view_dispose;
+ object_class->finalize = anjal_shell_view_finalize;
+ object_class->constructed = anjal_shell_view_constructed;
+
+ shell_view_class = E_SHELL_VIEW_CLASS (class);
+ shell_view_class->label = _("Mail");
+ shell_view_class->icon_name = "evolution-mail";
+ shell_view_class->ui_definition = "evolution-mail.ui";
+ shell_view_class->ui_manager_id = "org.gnome.evolution.mail";
+ shell_view_class->search_options = "/mail-search-options";
+ shell_view_class->search_rules = "searchtypes.xml";
+ shell_view_class->new_shell_content = anjal_shell_content_new;
+ shell_view_class->new_shell_sidebar = e_mail_shell_sidebar_new;
+ shell_view_class->toggled = anjal_shell_view_toggled;
+ shell_view_class->execute_search = anjal_shell_view_execute_search;
+ shell_view_class->update_actions = anjal_shell_view_update_actions;
+}
+
+static void
+anjal_shell_view_init (AnjalShellView *mail_shell_view,
+ EShellViewClass *shell_view_class)
+{
+ mail_shell_view->priv =
+ ANJAL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);
+
+ anjal_shell_view_private_init (mail_shell_view, shell_view_class);
+}
+
+GType
+anjal_shell_view_get_type (void)
+{
+ return anjal_shell_view_type;
+}
+
+void
+anjal_shell_view_register_type (GTypeModule *type_module)
+{
+ const GTypeInfo type_info = {
+ sizeof (AnjalShellViewClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) anjal_shell_view_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (AnjalShellView),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) anjal_shell_view_init,
+ NULL /* value_table */
+ };
+
+ anjal_shell_view_type = g_type_module_register_type (
+ type_module, E_TYPE_SHELL_VIEW,
+ "AnjalShellView", &type_info, 0);
+}
diff --git a/modules/mail/anjal-shell-view.h b/modules/mail/anjal-shell-view.h
new file mode 100644
index 0000000..30b809c
--- /dev/null
+++ b/modules/mail/anjal-shell-view.h
@@ -0,0 +1,76 @@
+/*
+ * anjal-shell-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef ANJAL_SHELL_VIEW_H
+#define ANJAL_SHELL_VIEW_H
+
+#include <shell/e-shell-view.h>
+#include <mail/anjal-mail-view.h>
+
+/* Standard GObject macros */
+#define ANJAL_TYPE_SHELL_VIEW \
+ (anjal_shell_view_get_type ())
+#define ANJAL_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellView))
+#define ANJAL_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewClass))
+#define ANJAL_IS_SHELL_VIEW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), ANJAL_TYPE_SHELL_VIEW))
+#define ANJAL_IS_SHELL_VIEW_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), ANJAL_TYPE_SHELL_VIEW))
+#define ANJAL_SHELL_VIEW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), ANJAL_TYPE_SHELL_VIEW, AnjalShellViewClass))
+
+G_BEGIN_DECLS
+
+typedef struct _AnjalShellView AnjalShellView;
+typedef struct _AnjalShellViewClass AnjalShellViewClass;
+typedef struct _AnjalShellViewPrivate AnjalShellViewPrivate;
+
+struct _AnjalShellView {
+ EShellView parent;
+ AnjalShellViewPrivate *priv;
+};
+
+struct _AnjalShellViewClass {
+ EShellViewClass parent_class;
+};
+
+GType anjal_shell_view_get_type (void);
+void anjal_shell_view_register_type
+ (GTypeModule *type_module);
+gboolean anjal_shell_view_get_show_deleted
+ (AnjalShellView *mail_shell_view);
+void anjal_shell_view_set_show_deleted
+ (AnjalShellView *mail_shell_view,
+ gboolean show_deleted);
+void anjal_shell_view_set_mail_view
+ (AnjalShellView *mail_shell_view,
+ AnjalMailView *mail_view);
+
+G_END_DECLS
+
+#endif /* ANJAL_SHELL_VIEW_H */
diff --git a/modules/mail/e-mail-anjal-shared.c b/modules/mail/e-mail-anjal-shared.c
new file mode 100644
index 0000000..66a624d
--- /dev/null
+++ b/modules/mail/e-mail-anjal-shared.c
@@ -0,0 +1,691 @@
+static void
+mail_shell_backend_init_importers (void)
+{
+ EImportClass *import_class;
+ EImportImporter *importer;
+
+ import_class = g_type_class_ref (e_import_get_type ());
+
+ importer = mbox_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = elm_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+
+ importer = pine_importer_peek ();
+ e_import_class_add_importer (import_class, importer, NULL, NULL);
+}
+
+static void
+mail_shell_backend_mail_icon_cb (EShellWindow *shell_window,
+ const gchar *icon_name)
+{
+ GtkAction *action;
+
+ action = e_shell_window_get_shell_view_action (
+ shell_window, BACKEND_NAME);
+ g_object_set (action, "icon-name", icon_name, NULL);
+}
+
+static void
+action_mail_folder_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EMFolderTree *folder_tree = NULL;
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ const gchar *view_name;
+
+ /* Take care not to unnecessarily load the mail shell view. */
+ view_name = e_shell_window_get_active_view (shell_window);
+ if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
+ goto exit;
+
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+exit:
+ em_folder_utils_create_folder (
+ NULL, folder_tree, GTK_WINDOW (shell_window));
+}
+
+static void
+action_mail_message_new_cb (GtkAction *action,
+ EShellWindow *shell_window)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EShellSidebar *shell_sidebar;
+ EShellView *shell_view;
+ EMFolderTree *folder_tree;
+ const gchar *view_name;
+ gchar *uri = NULL;
+
+ if (!em_utils_check_user_can_send_mail ())
+ return;
+
+ /* Take care not to unnecessarily load the mail shell view. */
+ view_name = e_shell_window_get_active_view (shell_window);
+ if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
+ goto exit;
+
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+
+ mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ uri = em_folder_tree_get_selected_uri (folder_tree);
+
+exit:
+ em_utils_compose_new_message (uri);
+
+ g_free (uri);
+}
+
+static GtkActionEntry item_entries[] = {
+
+ { "mail-message-new",
+ "mail-message-new",
+ NC_("New", "_Mail Message"),
+ "<Shift><Control>m",
+ N_("Compose a new mail message"),
+ G_CALLBACK (action_mail_message_new_cb) }
+};
+
+static GtkActionEntry source_entries[] = {
+
+ { "mail-folder-new",
+ "folder-new",
+ NC_("New", "Mail _Folder"),
+ NULL,
+ N_("Create a new mail folder"),
+ G_CALLBACK (action_mail_folder_new_cb) }
+};
+
+static gboolean
+mail_shell_backend_init_preferences (EShell *shell)
+{
+ EAccountList *account_list;
+ GtkWidget *preferences_window;
+
+ /* This is a main loop idle callback. */
+
+ account_list = e_get_account_list ();
+ preferences_window = e_shell_get_preferences_window (shell);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail-accounts",
+ "preferences-mail-accounts",
+ _("Mail Accounts"),
+ em_account_prefs_new (account_list),
+ 100);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "mail",
+ "preferences-mail",
+ _("Mail Preferences"),
+ em_mailer_prefs_new (shell),
+ 300);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "composer",
+ "preferences-composer",
+ _("Composer Preferences"),
+ em_composer_prefs_new (shell),
+ 400);
+
+ e_preferences_window_add_page (
+ E_PREFERENCES_WINDOW (preferences_window),
+ "system-network-proxy",
+ "preferences-system-network-proxy",
+ _("Network Preferences"),
+ em_network_prefs_new (),
+ 500);
+
+ return FALSE;
+}
+
+static void
+mail_shell_backend_notify_online_cb (EShell *shell,
+ GParamSpec *pspec,
+ EShellBackend *shell_backend)
+{
+ gboolean online;
+
+ online = e_shell_get_online (shell);
+ camel_session_set_online (session, online);
+}
+
+static void
+mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
+ CamelFolder *folder,
+ gpointer user_data)
+{
+ EShellBackend *shell_backend = user_data;
+ CamelURL *url = user_data;
+ const gchar *forward;
+ const gchar *reply;
+ const gchar *uid;
+
+ if (folder == NULL) {
+ g_warning ("Could not open folder '%s'", folder_uri);
+ goto exit;
+ }
+
+ forward = camel_url_get_param (url, "forward");
+ reply = camel_url_get_param (url, "reply");
+ uid = camel_url_get_param (url, "uid");
+
+ if (reply != NULL) {
+ gint mode;
+
+ if (g_strcmp0 (reply, "all") == 0)
+ mode = REPLY_MODE_ALL;
+ else if (g_strcmp0 (reply, "list") == 0)
+ mode = REPLY_MODE_LIST;
+ else
+ mode = REPLY_MODE_SENDER;
+
+ em_utils_reply_to_message (folder, uid, NULL, mode, NULL);
+
+ } else if (forward != NULL) {
+ GPtrArray *uids;
+
+ uids = g_ptr_array_new ();
+ g_ptr_array_add (uids, g_strdup (uid));
+
+ if (g_strcmp0 (forward, "attached") == 0)
+ em_utils_forward_attached (folder, uids, folder_uri);
+ else if (g_strcmp0 (forward, "inline") == 0)
+ em_utils_forward_inline (folder, uids, folder_uri);
+ else if (g_strcmp0 (forward, "quoted") == 0)
+ em_utils_forward_quoted (folder, uids, folder_uri);
+ else
+ em_utils_forward_messages (folder, uids, folder_uri);
+
+ } else {
+ GtkWidget *browser;
+
+ /* FIXME Should pass in the shell module. */
+ browser = e_mail_browser_new (shell_backend);
+ e_mail_reader_set_folder (
+ E_MAIL_READER (browser), folder, folder_uri);
+ e_mail_reader_set_message (E_MAIL_READER (browser), uid);
+ gtk_widget_show (browser);
+ }
+
+exit:
+ camel_url_free (url);
+}
+
+static gboolean
+mail_shell_backend_handle_uri_cb (EShell *shell,
+ const gchar *uri,
+ gpointer mail_shell_backend)
+{
+ gboolean handled = TRUE;
+
+ if (g_str_has_prefix (uri, "mailto:")) {
+ if (em_utils_check_user_can_send_mail ())
+ em_utils_compose_new_message_with_mailto (uri, NULL);
+
+ } else if (g_str_has_prefix (uri, "email:")) {
+ CamelURL *url;
+
+ url = camel_url_new (uri, NULL);
+ if (camel_url_get_param (url, "uid") != NULL) {
+ gchar *curi = em_uri_to_camel (uri);
+
+ mail_get_folder (
+ curi, 0,
+ mail_shell_backend_handle_email_uri_cb,
+ mail_shell_backend, mail_msg_unordered_push);
+ g_free (curi);
+
+ } else {
+ g_warning ("Email URI's must include a uid parameter");
+ camel_url_free (url);
+ }
+ } else
+ handled = FALSE;
+
+ return handled;
+}
+
+/* Helper for mail_shell_backend_prepare_for_[off|on]line_cb() */
+static void
+mail_shell_store_line_transition_done_cb (CamelStore *store,
+ gpointer user_data)
+{
+ EActivity *activity = user_data;
+
+ g_object_unref (activity);
+}
+
+/* Helper for mail_shell_backend_prepare_for_offline_cb() */
+static void
+mail_shell_store_prepare_for_offline_cb (CamelService *service,
+ gpointer unused,
+ EActivity *activity)
+{
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_set_offline (
+ CAMEL_STORE (service), TRUE,
+ mail_shell_store_line_transition_done_cb,
+ g_object_ref (activity));
+}
+
+static void
+mail_shell_backend_prepare_for_offline_cb (EShell *shell,
+ EActivity *activity,
+ gpointer mail_shell_backend)
+{
+ gboolean synchronize = FALSE;
+
+ if (e_shell_get_network_available (shell))
+ synchronize = em_utils_prompt_user (
+ e_shell_get_active_window (shell), NULL,
+ "mail:ask-quick-offline", NULL);
+
+ if (!synchronize) {
+ mail_cancel_all ();
+ camel_session_set_network_state (session, FALSE);
+ }
+
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_store_prepare_for_offline_cb, activity);
+}
+
+/* Helper for mail_shell_backend_prepare_for_online_cb() */
+static void
+mail_shell_store_prepare_for_online_cb (CamelService *service,
+ gpointer unused,
+ EActivity *activity)
+{
+ if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
+ mail_store_set_offline (
+ CAMEL_STORE (service), FALSE,
+ mail_shell_store_line_transition_done_cb,
+ g_object_ref (activity));
+}
+
+static void
+mail_shell_backend_prepare_for_online_cb (EShell *shell,
+ EActivity *activity,
+ gpointer mail_shell_backend)
+{
+ camel_session_set_online (session, TRUE);
+
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_store_prepare_for_online_cb, activity);
+}
+
+/* Helper for mail_shell_backend_prepare_for_quit_cb() */
+static void
+mail_shell_backend_empty_junk (CamelStore *store,
+ gpointer opaque_store_info,
+ gpointer mail_shell_backend)
+{
+ CamelFolder *folder;
+ GPtrArray *uids;
+ guint32 flags;
+ guint32 mask;
+ guint ii;
+
+ folder = camel_store_get_junk (store, NULL);
+ if (folder == NULL)
+ return;
+
+ uids = camel_folder_get_uids (folder);
+ flags = mask = CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN;
+
+ camel_folder_freeze (folder);
+
+ for (ii = 0; ii < uids->len; ii++) {
+ const gchar *uid = uids->pdata[ii];
+ camel_folder_set_message_flags (folder, uid, flags, mask);
+ }
+
+ camel_folder_thaw (folder);
+
+ camel_folder_free_uids (folder, uids);
+}
+
+/* Helper for mail_shell_backend_final_sync() */
+static void
+mail_shell_backend_final_sync_done_cb (CamelStore *store,
+ gpointer user_data)
+{
+ g_object_unref (E_ACTIVITY (user_data));
+}
+
+/* Helper for mail_shell_backend_prepare_for_quit_cb() */
+static void
+mail_shell_backend_final_sync (CamelStore *store,
+ gpointer opaque_store_info,
+ gpointer user_data)
+{
+ struct {
+ EActivity *activity;
+ gboolean empty_trash;
+ } *sync_data = user_data;
+
+ /* Reffing the activity delays quitting; the reference count
+ * acts like a counting semaphore. */
+ mail_sync_store (
+ store, sync_data->empty_trash,
+ mail_shell_backend_final_sync_done_cb,
+ g_object_ref (sync_data->activity));
+}
+
+/* Helper for mail_shell_backend_prepare_for_quit_cb() */
+static gboolean
+mail_shell_backend_poll_to_quit (EActivity *activity)
+{
+ return mail_msg_active ((guint) -1);
+}
+
+/* Helper for mail_shell_backend_prepare_for_quit_cb() */
+static void
+mail_shell_backend_ready_to_quit (EActivity *activity)
+{
+ mail_session_shutdown ();
+ g_object_unref (activity);
+ emu_free_mail_cache ();
+}
+
+static void
+mail_shell_backend_prepare_for_quit_cb (EShell *shell,
+ EActivity *activity,
+ gpointer mail_shell_backend)
+{
+ EShellSettings *shell_settings;
+ EAccountList *account_list;
+ GConfClient *client;
+ const gchar *key;
+ gboolean empty_junk;
+ gboolean empty_trash;
+ gint empty_date;
+ gint empty_days;
+ gint now;
+ GError *error = NULL;
+
+ struct {
+ EActivity *activity;
+ gboolean empty_trash;
+ } sync_data;
+
+ client = e_shell_get_gconf_client (shell);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ camel_application_is_exiting = TRUE;
+ now = time (NULL) / 60 / 60 / 24;
+
+ account_list = e_get_account_list ();
+ e_account_list_prune_proxies (account_list);
+
+ mail_vfolder_shutdown ();
+
+ empty_junk = e_shell_settings_get_boolean (
+ shell_settings, "mail-empty-junk-on-exit");
+
+ empty_trash = e_shell_settings_get_boolean (
+ shell_settings, "mail-empty-trash-on-exit");
+
+ /* XXX No EShellSettings properties for these keys. */
+
+ empty_date = empty_days = 0;
+
+ if (empty_junk) {
+ key = "/apps/evolution/mail/junk/empty_on_exit_days";
+ empty_days = gconf_client_get_int (client, key, &error);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ empty_trash = FALSE;
+ }
+ }
+
+ if (empty_junk) {
+ key = "/apps/evolution/mail/junk/empty_date";
+ empty_date = gconf_client_get_int (client, key, &error);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ empty_trash = FALSE;
+ }
+ }
+
+ empty_junk &= (empty_days = 0) || (empty_date + empty_days <= now);
+
+ if (empty_junk) {
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_backend_empty_junk,
+ mail_shell_backend);
+
+ key = "/apps/evolution/mail/junk/empty_date";
+ gconf_client_set_int (client, key, now, NULL);
+ }
+
+ empty_date = empty_days = 0;
+
+ if (empty_trash) {
+ key = "/apps/evolution/mail/trash/empty_on_exit_days";
+ empty_days = gconf_client_get_int (client, key, &error);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ empty_trash = FALSE;
+ }
+ }
+
+ if (empty_trash) {
+ key = "/apps/evolution/mail/trash/empty_date";
+ empty_date = gconf_client_get_int (client, key, &error);
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ empty_trash = FALSE;
+ }
+ }
+
+ empty_trash &= (empty_days == 0) || (empty_date + empty_days <= now);
+
+ sync_data.activity = activity;
+ sync_data.empty_trash = empty_trash;
+
+ e_mail_store_foreach (
+ (GHFunc) mail_shell_backend_final_sync, &sync_data);
+
+ if (empty_trash) {
+ key = "/apps/evolution/mail/trash/empty_date";
+ gconf_client_set_int (client, key, now, NULL);
+ }
+
+ /* Cancel all activities. */
+ mail_cancel_all ();
+
+ /* Now we poll until all activities are actually cancelled.
+ * Reffing the activity delays quitting; the reference count
+ * acts like a counting semaphore. */
+ if (mail_msg_active ((guint) -1))
+ g_timeout_add_seconds_full (
+ G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL,
+ (GSourceFunc) mail_shell_backend_poll_to_quit,
+ g_object_ref (activity),
+ (GDestroyNotify) mail_shell_backend_ready_to_quit);
+ else
+ mail_shell_backend_ready_to_quit (g_object_ref (activity));
+}
+
+static void
+mail_shell_backend_quit_requested_cb (EShell *shell,
+ EShellBackend *shell_backend)
+{
+ CamelFolder *folder;
+ guint32 unsent;
+ gint response;
+
+ /* We can quit immediately if offline. */
+ if (!camel_session_is_online (session))
+ return;
+
+ /* Check Outbox for any unsent messages. */
+
+ folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
+ if (folder == NULL)
+ return;
+
+ if (camel_object_get (
+ folder, NULL, CAMEL_FOLDER_VISIBLE, &unsent, 0) != 0)
+ return;
+
+ if (unsent == 0)
+ return;
+
+ response = e_error_run (e_shell_get_active_window (shell), "mail:exit-unsaved", NULL);
+
+ if (response == GTK_RESPONSE_YES)
+ return;
+
+ e_shell_cancel_quit (shell);
+}
+
+static void
+mail_shell_backend_send_receive_cb (EShell *shell,
+ GtkWindow *parent,
+ EShellBackend *shell_backend)
+{
+ em_utils_clear_get_password_canceled_accounts_flag ();
+ mail_send_receive (parent);
+}
+
+static void
+mail_shell_backend_window_weak_notify_cb (EShell *shell,
+ GObject *where_the_object_was)
+{
+ g_signal_handlers_disconnect_by_func (
+ shell, mail_shell_backend_mail_icon_cb,
+ where_the_object_was);
+}
+
+static void
+mail_shell_backend_window_created_cb (EShell *shell,
+ GtkWindow *window,
+ EShellBackend *shell_backend)
+{
+ EShellSettings *shell_settings;
+ static gboolean first_time = TRUE;
+ const gchar *backend_name;
+
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ /* This applies to both the composer and signature editor. */
+ if (GTKHTML_IS_EDITOR (window)) {
+ GList *spell_languages;
+
+ e_binding_new (
+ shell_settings, "composer-inline-spelling",
+ window, "inline-spelling");
+
+ e_binding_new (
+ shell_settings, "composer-magic-links",
+ window, "magic-links");
+
+ e_binding_new (
+ shell_settings, "composer-magic-smileys",
+ window, "magic-smileys");
+
+ spell_languages = e_load_spell_languages ();
+ gtkhtml_editor_set_spell_languages (
+ GTKHTML_EDITOR (window), spell_languages);
+ g_list_free (spell_languages);
+ }
+
+ if (E_IS_MSG_COMPOSER (window)) {
+ /* Integrate the new composer into the mail module. */
+ em_configure_new_composer (E_MSG_COMPOSER (window));
+ return;
+ }
+
+ if (!E_IS_SHELL_WINDOW (window))
+ return;
+
+ backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
+
+// e_shell_window_register_new_item_actions (
+// E_SHELL_WINDOW (window), backend_name,
+// item_entries, G_N_ELEMENTS (item_entries));
+
+// e_shell_window_register_new_source_actions (
+// E_SHELL_WINDOW (window), backend_name,
+// source_entries, G_N_ELEMENTS (source_entries));
+
+ g_signal_connect_swapped (
+ shell, "event::mail-icon",
+ G_CALLBACK (mail_shell_backend_mail_icon_cb), window);
+
+ g_object_weak_ref (
+ G_OBJECT (window), (GWeakNotify)
+ mail_shell_backend_window_weak_notify_cb, shell);
+
+ if (first_time) {
+ g_signal_connect (
+ window, "map-event",
+ G_CALLBACK (e_msg_composer_check_autosave), NULL);
+ first_time = FALSE;
+ }
+}
+
+/******************* Code below here belongs elsewhere. *******************/
+
+#include "filter/e-filter-option.h"
+#include "shell/e-shell-settings.h"
+#include "mail/e-mail-label-list-store.h"
+
+GSList *
+e_mail_labels_get_filter_options (void)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+ EMailLabelListStore *list_store;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GSList *list = NULL;
+ gboolean valid;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+ list_store = e_shell_settings_get_object (
+ shell_settings, "mail-label-list-store");
+
+ model = GTK_TREE_MODEL (list_store);
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+
+ while (valid) {
+ struct _filter_option *option;
+ gchar *name, *tag;
+
+ name = e_mail_label_list_store_get_name (list_store, &iter);
+ tag = e_mail_label_list_store_get_tag (list_store, &iter);
+
+ option = g_new0 (struct _filter_option, 1);
+ option->title = e_str_without_underscores (name);
+ option->value = tag; /* takes ownership */
+ list = g_slist_prepend (list, option);
+
+ g_free (name);
+
+ valid = gtk_tree_model_iter_next (model, &iter);
+ }
+
+ g_object_unref (list_store);
+
+ return g_slist_reverse (list);
+}
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 0572cfd..f294f72 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -80,158 +80,7 @@ static GType mail_shell_backend_type;
extern gint camel_application_is_exiting;
-static void
-mail_shell_backend_init_importers (void)
-{
- EImportClass *import_class;
- EImportImporter *importer;
-
- import_class = g_type_class_ref (e_import_get_type ());
-
- importer = mbox_importer_peek ();
- e_import_class_add_importer (import_class, importer, NULL, NULL);
-
- importer = elm_importer_peek ();
- e_import_class_add_importer (import_class, importer, NULL, NULL);
-
- importer = pine_importer_peek ();
- e_import_class_add_importer (import_class, importer, NULL, NULL);
-}
-
-static void
-mail_shell_backend_mail_icon_cb (EShellWindow *shell_window,
- const gchar *icon_name)
-{
- GtkAction *action;
-
- action = e_shell_window_get_shell_view_action (
- shell_window, BACKEND_NAME);
- g_object_set (action, "icon-name", icon_name, NULL);
-}
-
-static void
-action_mail_folder_new_cb (GtkAction *action,
- EShellWindow *shell_window)
-{
- EMFolderTree *folder_tree = NULL;
- EMailShellSidebar *mail_shell_sidebar;
- EShellSidebar *shell_sidebar;
- EShellView *shell_view;
- const gchar *view_name;
-
- /* Take care not to unnecessarily load the mail shell view. */
- view_name = e_shell_window_get_active_view (shell_window);
- if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
- goto exit;
-
- shell_view = e_shell_window_get_shell_view (shell_window, view_name);
- shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
-
- mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
- folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
-
-exit:
- em_folder_utils_create_folder (
- NULL, folder_tree, GTK_WINDOW (shell_window));
-}
-
-static void
-action_mail_message_new_cb (GtkAction *action,
- EShellWindow *shell_window)
-{
- EMailShellSidebar *mail_shell_sidebar;
- EShellSidebar *shell_sidebar;
- EShellView *shell_view;
- EMFolderTree *folder_tree;
- const gchar *view_name;
- gchar *uri = NULL;
-
- if (!em_utils_check_user_can_send_mail ())
- return;
-
- /* Take care not to unnecessarily load the mail shell view. */
- view_name = e_shell_window_get_active_view (shell_window);
- if (g_strcmp0 (view_name, BACKEND_NAME) != 0)
- goto exit;
-
- shell_view = e_shell_window_get_shell_view (shell_window, view_name);
- shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
-
- mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
- folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
- uri = em_folder_tree_get_selected_uri (folder_tree);
-
-exit:
- em_utils_compose_new_message (uri);
-
- g_free (uri);
-}
-
-static GtkActionEntry item_entries[] = {
-
- { "mail-message-new",
- "mail-message-new",
- NC_("New", "_Mail Message"),
- "<Shift><Control>m",
- N_("Compose a new mail message"),
- G_CALLBACK (action_mail_message_new_cb) }
-};
-
-static GtkActionEntry source_entries[] = {
-
- { "mail-folder-new",
- "folder-new",
- NC_("New", "Mail _Folder"),
- NULL,
- N_("Create a new mail folder"),
- G_CALLBACK (action_mail_folder_new_cb) }
-};
-
-static gboolean
-mail_shell_backend_init_preferences (EShell *shell)
-{
- EAccountList *account_list;
- GtkWidget *preferences_window;
-
- /* This is a main loop idle callback. */
-
- account_list = e_get_account_list ();
- preferences_window = e_shell_get_preferences_window (shell);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "mail-accounts",
- "preferences-mail-accounts",
- _("Mail Accounts"),
- em_account_prefs_new (account_list),
- 100);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "mail",
- "preferences-mail",
- _("Mail Preferences"),
- em_mailer_prefs_new (shell),
- 300);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "composer",
- "preferences-composer",
- _("Composer Preferences"),
- em_composer_prefs_new (shell),
- 400);
-
- e_preferences_window_add_page (
- E_PREFERENCES_WINDOW (preferences_window),
- "system-network-proxy",
- "preferences-system-network-proxy",
- _("Network Preferences"),
- em_network_prefs_new (),
- 500);
-
- return FALSE;
-}
+#include "e-mail-anjal-shared.c"
static void
mail_shell_backend_sync_store_done_cb (CamelStore *store,
@@ -276,498 +125,6 @@ exit:
}
static void
-mail_shell_backend_notify_online_cb (EShell *shell,
- GParamSpec *pspec,
- EShellBackend *shell_backend)
-{
- gboolean online;
-
- online = e_shell_get_online (shell);
- camel_session_set_online (session, online);
-}
-
-static void
-mail_shell_backend_handle_email_uri_cb (gchar *folder_uri,
- CamelFolder *folder,
- gpointer user_data)
-{
- EShellBackend *shell_backend = user_data;
- CamelURL *url = user_data;
- const gchar *forward;
- const gchar *reply;
- const gchar *uid;
-
- if (folder == NULL) {
- g_warning ("Could not open folder '%s'", folder_uri);
- goto exit;
- }
-
- forward = camel_url_get_param (url, "forward");
- reply = camel_url_get_param (url, "reply");
- uid = camel_url_get_param (url, "uid");
-
- if (reply != NULL) {
- gint mode;
-
- if (g_strcmp0 (reply, "all") == 0)
- mode = REPLY_MODE_ALL;
- else if (g_strcmp0 (reply, "list") == 0)
- mode = REPLY_MODE_LIST;
- else
- mode = REPLY_MODE_SENDER;
-
- em_utils_reply_to_message (folder, uid, NULL, mode, NULL);
-
- } else if (forward != NULL) {
- GPtrArray *uids;
-
- uids = g_ptr_array_new ();
- g_ptr_array_add (uids, g_strdup (uid));
-
- if (g_strcmp0 (forward, "attached") == 0)
- em_utils_forward_attached (folder, uids, folder_uri);
- else if (g_strcmp0 (forward, "inline") == 0)
- em_utils_forward_inline (folder, uids, folder_uri);
- else if (g_strcmp0 (forward, "quoted") == 0)
- em_utils_forward_quoted (folder, uids, folder_uri);
- else
- em_utils_forward_messages (folder, uids, folder_uri);
-
- } else {
- GtkWidget *browser;
-
- /* FIXME Should pass in the shell module. */
- browser = e_mail_browser_new (shell_backend);
- e_mail_reader_set_folder (
- E_MAIL_READER (browser), folder, folder_uri);
- e_mail_reader_set_message (E_MAIL_READER (browser), uid);
- gtk_widget_show (browser);
- }
-
-exit:
- camel_url_free (url);
-}
-
-static gboolean
-mail_shell_backend_handle_uri_cb (EShell *shell,
- const gchar *uri,
- EMailShellBackend *mail_shell_backend)
-{
- gboolean handled = TRUE;
-
- if (g_str_has_prefix (uri, "mailto:")) {
- if (em_utils_check_user_can_send_mail ())
- em_utils_compose_new_message_with_mailto (uri, NULL);
-
- } else if (g_str_has_prefix (uri, "email:")) {
- CamelURL *url;
-
- url = camel_url_new (uri, NULL);
- if (camel_url_get_param (url, "uid") != NULL) {
- gchar *curi = em_uri_to_camel (uri);
-
- mail_get_folder (
- curi, 0,
- mail_shell_backend_handle_email_uri_cb,
- mail_shell_backend, mail_msg_unordered_push);
- g_free (curi);
-
- } else {
- g_warning ("Email URI's must include a uid parameter");
- camel_url_free (url);
- }
- } else
- handled = FALSE;
-
- return handled;
-}
-
-/* Helper for mail_shell_backend_prepare_for_[off|on]line_cb() */
-static void
-mail_shell_store_line_transition_done_cb (CamelStore *store,
- gpointer user_data)
-{
- EActivity *activity = user_data;
-
- g_object_unref (activity);
-}
-
-/* Helper for mail_shell_backend_prepare_for_offline_cb() */
-static void
-mail_shell_store_prepare_for_offline_cb (CamelService *service,
- gpointer unused,
- EActivity *activity)
-{
- if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
- mail_store_set_offline (
- CAMEL_STORE (service), TRUE,
- mail_shell_store_line_transition_done_cb,
- g_object_ref (activity));
-}
-
-static void
-mail_shell_backend_prepare_for_offline_cb (EShell *shell,
- EActivity *activity,
- EMailShellBackend *mail_shell_backend)
-{
- gboolean synchronize = FALSE;
-
- if (e_shell_get_network_available (shell))
- synchronize = em_utils_prompt_user (
- e_shell_get_active_window (shell), NULL,
- "mail:ask-quick-offline", NULL);
-
- if (!synchronize) {
- mail_cancel_all ();
- camel_session_set_network_state (session, FALSE);
- }
-
- e_mail_store_foreach (
- (GHFunc) mail_shell_store_prepare_for_offline_cb, activity);
-}
-
-/* Helper for mail_shell_backend_prepare_for_online_cb() */
-static void
-mail_shell_store_prepare_for_online_cb (CamelService *service,
- gpointer unused,
- EActivity *activity)
-{
- if (CAMEL_IS_DISCO_STORE (service) || CAMEL_IS_OFFLINE_STORE (service))
- mail_store_set_offline (
- CAMEL_STORE (service), FALSE,
- mail_shell_store_line_transition_done_cb,
- g_object_ref (activity));
-}
-
-static void
-mail_shell_backend_prepare_for_online_cb (EShell *shell,
- EActivity *activity,
- EMailShellBackend *mail_shell_backend)
-{
- camel_session_set_online (session, TRUE);
-
- e_mail_store_foreach (
- (GHFunc) mail_shell_store_prepare_for_online_cb, activity);
-}
-
-/* Helper for mail_shell_backend_prepare_for_quit_cb() */
-static void
-mail_shell_backend_empty_junk (CamelStore *store,
- gpointer opaque_store_info,
- EMailShellBackend *mail_shell_backend)
-{
- CamelFolder *folder;
- GPtrArray *uids;
- guint32 flags;
- guint32 mask;
- guint ii;
-
- folder = camel_store_get_junk (store, NULL);
- if (folder == NULL)
- return;
-
- uids = camel_folder_get_uids (folder);
- flags = mask = CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN;
-
- camel_folder_freeze (folder);
-
- for (ii = 0; ii < uids->len; ii++) {
- const gchar *uid = uids->pdata[ii];
- camel_folder_set_message_flags (folder, uid, flags, mask);
- }
-
- camel_folder_thaw (folder);
-
- camel_folder_free_uids (folder, uids);
-}
-
-/* Helper for mail_shell_backend_final_sync() */
-static void
-mail_shell_backend_final_sync_done_cb (CamelStore *store,
- gpointer user_data)
-{
- g_object_unref (E_ACTIVITY (user_data));
-}
-
-/* Helper for mail_shell_backend_prepare_for_quit_cb() */
-static void
-mail_shell_backend_final_sync (CamelStore *store,
- gpointer opaque_store_info,
- gpointer user_data)
-{
- struct {
- EActivity *activity;
- gboolean empty_trash;
- } *sync_data = user_data;
-
- /* Reffing the activity delays quitting; the reference count
- * acts like a counting semaphore. */
- mail_sync_store (
- store, sync_data->empty_trash,
- mail_shell_backend_final_sync_done_cb,
- g_object_ref (sync_data->activity));
-}
-
-/* Helper for mail_shell_backend_prepare_for_quit_cb() */
-static gboolean
-mail_shell_backend_poll_to_quit (EActivity *activity)
-{
- return mail_msg_active ((guint) -1);
-}
-
-/* Helper for mail_shell_backend_prepare_for_quit_cb() */
-static void
-mail_shell_backend_ready_to_quit (EActivity *activity)
-{
- mail_session_shutdown ();
- g_object_unref (activity);
- emu_free_mail_cache ();
-}
-
-static void
-mail_shell_backend_prepare_for_quit_cb (EShell *shell,
- EActivity *activity,
- EMailShellBackend *mail_shell_backend)
-{
- EShellSettings *shell_settings;
- EAccountList *account_list;
- GConfClient *client;
- const gchar *key;
- gboolean empty_junk;
- gboolean empty_trash;
- gint empty_date;
- gint empty_days;
- gint now;
- GError *error = NULL;
-
- struct {
- EActivity *activity;
- gboolean empty_trash;
- } sync_data;
-
- client = e_shell_get_gconf_client (shell);
- shell_settings = e_shell_get_shell_settings (shell);
-
- camel_application_is_exiting = TRUE;
- now = time (NULL) / 60 / 60 / 24;
-
- account_list = e_get_account_list ();
- e_account_list_prune_proxies (account_list);
-
- mail_vfolder_shutdown ();
-
- empty_junk = e_shell_settings_get_boolean (
- shell_settings, "mail-empty-junk-on-exit");
-
- empty_trash = e_shell_settings_get_boolean (
- shell_settings, "mail-empty-trash-on-exit");
-
- /* XXX No EShellSettings properties for these keys. */
-
- empty_date = empty_days = 0;
-
- if (empty_junk) {
- key = "/apps/evolution/mail/junk/empty_on_exit_days";
- empty_days = gconf_client_get_int (client, key, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- empty_trash = FALSE;
- }
- }
-
- if (empty_junk) {
- key = "/apps/evolution/mail/junk/empty_date";
- empty_date = gconf_client_get_int (client, key, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- empty_trash = FALSE;
- }
- }
-
- empty_junk &= (empty_days = 0) || (empty_date + empty_days <= now);
-
- if (empty_junk) {
- e_mail_store_foreach (
- (GHFunc) mail_shell_backend_empty_junk,
- mail_shell_backend);
-
- key = "/apps/evolution/mail/junk/empty_date";
- gconf_client_set_int (client, key, now, NULL);
- }
-
- empty_date = empty_days = 0;
-
- if (empty_trash) {
- key = "/apps/evolution/mail/trash/empty_on_exit_days";
- empty_days = gconf_client_get_int (client, key, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- empty_trash = FALSE;
- }
- }
-
- if (empty_trash) {
- key = "/apps/evolution/mail/trash/empty_date";
- empty_date = gconf_client_get_int (client, key, &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_clear_error (&error);
- empty_trash = FALSE;
- }
- }
-
- empty_trash &= (empty_days == 0) || (empty_date + empty_days <= now);
-
- sync_data.activity = activity;
- sync_data.empty_trash = empty_trash;
-
- e_mail_store_foreach (
- (GHFunc) mail_shell_backend_final_sync, &sync_data);
-
- if (empty_trash) {
- key = "/apps/evolution/mail/trash/empty_date";
- gconf_client_set_int (client, key, now, NULL);
- }
-
- /* Cancel all activities. */
- mail_cancel_all ();
-
- /* Now we poll until all activities are actually cancelled.
- * Reffing the activity delays quitting; the reference count
- * acts like a counting semaphore. */
- if (mail_msg_active ((guint) -1))
- g_timeout_add_seconds_full (
- G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL,
- (GSourceFunc) mail_shell_backend_poll_to_quit,
- g_object_ref (activity),
- (GDestroyNotify) mail_shell_backend_ready_to_quit);
- else
- mail_shell_backend_ready_to_quit (g_object_ref (activity));
-}
-
-static void
-mail_shell_backend_quit_requested_cb (EShell *shell,
- EShellBackend *shell_backend)
-{
- CamelFolder *folder;
- guint32 unsent;
- gint response;
-
- /* We can quit immediately if offline. */
- if (!camel_session_is_online (session))
- return;
-
- /* Check Outbox for any unsent messages. */
-
- folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX);
- if (folder == NULL)
- return;
-
- if (camel_object_get (
- folder, NULL, CAMEL_FOLDER_VISIBLE, &unsent, 0) != 0)
- return;
-
- if (unsent == 0)
- return;
-
- response = e_error_run (e_shell_get_active_window (shell), "mail:exit-unsaved", NULL);
-
- if (response == GTK_RESPONSE_YES)
- return;
-
- e_shell_cancel_quit (shell);
-}
-
-static void
-mail_shell_backend_send_receive_cb (EShell *shell,
- GtkWindow *parent,
- EShellBackend *shell_backend)
-{
- em_utils_clear_get_password_canceled_accounts_flag ();
- mail_send_receive (parent);
-}
-
-static void
-mail_shell_backend_window_weak_notify_cb (EShell *shell,
- GObject *where_the_object_was)
-{
- g_signal_handlers_disconnect_by_func (
- shell, mail_shell_backend_mail_icon_cb,
- where_the_object_was);
-}
-
-static void
-mail_shell_backend_window_created_cb (EShell *shell,
- GtkWindow *window,
- EShellBackend *shell_backend)
-{
- EShellSettings *shell_settings;
- static gboolean first_time = TRUE;
- const gchar *backend_name;
-
- shell_settings = e_shell_get_shell_settings (shell);
-
- /* This applies to both the composer and signature editor. */
- if (GTKHTML_IS_EDITOR (window)) {
- GList *spell_languages;
-
- e_binding_new (
- shell_settings, "composer-inline-spelling",
- window, "inline-spelling");
-
- e_binding_new (
- shell_settings, "composer-magic-links",
- window, "magic-links");
-
- e_binding_new (
- shell_settings, "composer-magic-smileys",
- window, "magic-smileys");
-
- spell_languages = e_load_spell_languages ();
- gtkhtml_editor_set_spell_languages (
- GTKHTML_EDITOR (window), spell_languages);
- g_list_free (spell_languages);
- }
-
- if (E_IS_MSG_COMPOSER (window)) {
- /* Integrate the new composer into the mail module. */
- em_configure_new_composer (E_MSG_COMPOSER (window));
- return;
- }
-
- if (!E_IS_SHELL_WINDOW (window))
- return;
-
- backend_name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
-
- e_shell_window_register_new_item_actions (
- E_SHELL_WINDOW (window), backend_name,
- item_entries, G_N_ELEMENTS (item_entries));
-
- e_shell_window_register_new_source_actions (
- E_SHELL_WINDOW (window), backend_name,
- source_entries, G_N_ELEMENTS (source_entries));
-
- g_signal_connect_swapped (
- shell, "event::mail-icon",
- G_CALLBACK (mail_shell_backend_mail_icon_cb), window);
-
- g_object_weak_ref (
- G_OBJECT (window), (GWeakNotify)
- mail_shell_backend_window_weak_notify_cb, shell);
-
- if (first_time) {
- g_signal_connect (
- window, "map-event",
- G_CALLBACK (e_msg_composer_check_autosave), NULL);
- first_time = FALSE;
- }
-}
-
-static void
mail_shell_backend_constructed (GObject *object)
{
EMailShellBackendPrivate *priv;
@@ -933,49 +290,3 @@ e_mail_shell_backend_register_type (GTypeModule *type_module)
"EMailShellBackend", &type_info, 0);
}
-/******************* Code below here belongs elsewhere. *******************/
-
-#include "filter/e-filter-option.h"
-#include "shell/e-shell-settings.h"
-#include "mail/e-mail-label-list-store.h"
-
-GSList *
-e_mail_labels_get_filter_options (void)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- EMailLabelListStore *list_store;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GSList *list = NULL;
- gboolean valid;
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
- list_store = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
-
- model = GTK_TREE_MODEL (list_store);
- valid = gtk_tree_model_get_iter_first (model, &iter);
-
- while (valid) {
- struct _filter_option *option;
- gchar *name, *tag;
-
- name = e_mail_label_list_store_get_name (list_store, &iter);
- tag = e_mail_label_list_store_get_tag (list_store, &iter);
-
- option = g_new0 (struct _filter_option, 1);
- option->title = e_str_without_underscores (name);
- option->value = tag; /* takes ownership */
- list = g_slist_prepend (list, option);
-
- g_free (name);
-
- valid = gtk_tree_model_iter_next (model, &iter);
- }
-
- g_object_unref (list_store);
-
- return g_slist_reverse (list);
-}
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 465022a..fb4a6ab 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -35,6 +35,7 @@
#include "em-utils.h"
#include "mail-config.h"
#include "mail-ops.h"
+#include "message-list.h"
#include "e-mail-reader.h"
#include "e-mail-search-bar.h"
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index d182f98..bceacc5 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -364,6 +364,7 @@ mail_shell_sidebar_selection_changed_cb (EShellSidebar *shell_sidebar,
g_free (uri);
}
+#if 0 /* This shouldn't be done like this. */
static void
tree_hidden_key_event_cb (EMFolderTree *emft, GdkEvent *event, EShellView *shell_view)
{
@@ -386,6 +387,7 @@ tree_hidden_key_event_cb (EMFolderTree *emft, GdkEvent *event, EShellView *shell
}
}
}
+#endif
static void
mail_shell_sidebar_get_property (GObject *object,
@@ -483,8 +485,10 @@ mail_shell_sidebar_constructed (GObject *object)
e_binding_new (
shell_settings, "mail-side-bar-search",
widget, "enable-search");
-
+#if 0
+ /* NOTE: Commented, it shouldn't be done like this. */
g_signal_connect (widget, "hidden-key-event", G_CALLBACK (tree_hidden_key_event_cb), shell_view);
+#endif
tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree);
selection = gtk_tree_view_get_selection (tree_view);
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 3473d2a..22a473b 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -20,6 +20,7 @@
*/
#include "e-mail-shell-view-private.h"
+#include "message-list.h"
static void
action_gal_save_custom_view_cb (GtkAction *action,
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index d28de5a..a28a5f9 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -20,6 +20,7 @@
*/
#include "e-mail-shell-view-private.h"
+#include "message-list.h"
#include "widgets/menus/gal-view-factory-etable.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 1241716..884dc11 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -20,6 +20,7 @@
*/
#include "e-mail-shell-view-private.h"
+#include "message-list.h"
static gpointer parent_class;
static GType mail_shell_view_type;
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 3c85fec..7e14b91 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -57,6 +57,7 @@ struct _EShellContentPrivate {
GtkWidget *filter_combo_box;
GtkWidget *search_label;
GtkWidget *search_entry;
+ GtkWidget *search_entry_box;
GtkWidget *scope_label;
GtkWidget *scope_combo_box;
};
@@ -78,6 +79,7 @@ enum {
};
static gpointer parent_class;
+static void shell_content_construct_search_bar (EShellContent *shell_content);
static void
shell_content_dialog_rule_changed (GtkWidget *dialog,
@@ -551,7 +553,7 @@ shell_content_constructed (GObject *object)
shell_content);
widget = shell_content->priv->search_entry;
-
+ if (widget) {
action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
e_binding_new (
action, "sensitive",
@@ -576,7 +578,7 @@ shell_content_constructed (GObject *object)
widget = shell_content->priv->search_bar;
gtk_size_group_add_widget (size_group, widget);
-
+ }
shell_content_init_search_context (shell_content);
}
@@ -615,7 +617,8 @@ shell_content_size_request (GtkWidget *widget,
requisition->height = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_widget_size_request (child, requisition);
+ if (child)
+ gtk_widget_size_request (child, requisition);
child = priv->search_bar;
gtk_widget_size_request (child, &child_requisition);
@@ -665,7 +668,7 @@ shell_content_forall (GtkContainer *container,
priv = E_SHELL_CONTENT_GET_PRIVATE (container);
- if (include_internals)
+ if (include_internals && priv->search_bar)
callback (priv->search_bar, callback_data);
/* Chain up to parent's forall() method. */
@@ -702,7 +705,7 @@ shell_content_class_init (EShellContentClass *class)
container_class->forall = shell_content_forall;
class->new_search_context = e_rule_context_new;
-
+ class->construct_search_bar = NULL; //shell_content_construct_search_bar;
g_object_class_install_property (
object_class,
PROP_FILTER_ACTION,
@@ -837,17 +840,64 @@ shell_content_class_init (EShellContentClass *class)
G_PARAM_CONSTRUCT_ONLY));
}
+void
+e_shell_content_show_search_bar (EShellContent *shell_content, gboolean show)
+{
+ if (show)
+ gtk_widget_show (shell_content->priv->search_bar);
+ else
+ gtk_widget_hide (shell_content->priv->search_bar);
+}
+
+void
+e_shell_content_set_search_entry (EShellContent *shell_content, GtkEntry *search_entry, gboolean pack)
+{
+ GtkWidget *widget;
+
+ widget = (GtkWidget *)search_entry;
+ if (pack) {
+ gtk_label_set_mnemonic_widget ((GtkLabel *)shell_content->priv->search_label, widget);
+ gtk_box_pack_start ((GtkBox *)shell_content->priv->search_entry_box, widget, TRUE, TRUE, 0);
+ }
+ if (shell_content->priv->search_entry)
+ gtk_widget_destroy (shell_content->priv->search_entry);
+ shell_content->priv->search_entry = widget;
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "activate",
+ G_CALLBACK (shell_content_entry_activate_cb),
+ shell_content);
+
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (shell_content_entry_changed_cb),
+ shell_content);
+
+ g_signal_connect_swapped (
+ widget, "icon-press",
+ G_CALLBACK (shell_content_entry_icon_press_cb),
+ shell_content);
+
+ g_signal_connect_swapped (
+ widget, "icon-release",
+ G_CALLBACK (shell_content_entry_icon_release_cb),
+ shell_content);
+
+ g_signal_connect_swapped (
+ widget, "key-press-event",
+ G_CALLBACK (shell_content_entry_key_press_cb),
+ shell_content);
+
+}
+
static void
-shell_content_init (EShellContent *shell_content)
+shell_content_construct_search_bar (EShellContent *shell_content)
{
GtkBox *box;
GtkLabel *label;
GtkWidget *widget;
- shell_content->priv = E_SHELL_CONTENT_GET_PRIVATE (shell_content);
-
- GTK_WIDGET_SET_FLAGS (shell_content, GTK_NO_WINDOW);
-
/*** Build the Search Bar ***/
widget = gtk_hbox_new (FALSE, 24);
@@ -900,37 +950,15 @@ shell_content_init (EShellContent *shell_content)
gtk_widget_show (widget);
label = GTK_LABEL (widget);
-
+
+ /* Place holder for the search Entry */
+ widget = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (box, widget, TRUE, TRUE, 0);;
+ shell_content->priv->search_entry_box = widget;
+ gtk_widget_show (widget);
widget = e_hinted_entry_new ();
- gtk_label_set_mnemonic_widget (label, widget);
- gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
- shell_content->priv->search_entry = widget;
gtk_widget_show (widget);
-
- g_signal_connect_swapped (
- widget, "activate",
- G_CALLBACK (shell_content_entry_activate_cb),
- shell_content);
-
- g_signal_connect_swapped (
- widget, "changed",
- G_CALLBACK (shell_content_entry_changed_cb),
- shell_content);
-
- g_signal_connect_swapped (
- widget, "icon-press",
- G_CALLBACK (shell_content_entry_icon_press_cb),
- shell_content);
-
- g_signal_connect_swapped (
- widget, "icon-release",
- G_CALLBACK (shell_content_entry_icon_release_cb),
- shell_content);
-
- g_signal_connect_swapped (
- widget, "key-press-event",
- G_CALLBACK (shell_content_entry_key_press_cb),
- shell_content);
+ e_shell_content_set_search_entry (shell_content, (GtkEntry *)widget, TRUE);
/* Scope Combo Widgets */
@@ -948,6 +976,20 @@ shell_content_init (EShellContent *shell_content)
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
shell_content->priv->scope_combo_box = widget;
gtk_widget_show (widget);
+
+}
+
+static void
+shell_content_init (EShellContent *shell_content)
+{
+ shell_content->priv = E_SHELL_CONTENT_GET_PRIVATE (shell_content);
+
+ GTK_WIDGET_SET_FLAGS (shell_content, GTK_NO_WINDOW);
+
+ shell_content_construct_search_bar (shell_content);
+ if (E_SHELL_CONTENT_GET_CLASS(shell_content)->construct_search_bar)
+ E_SHELL_CONTENT_GET_CLASS(shell_content)->construct_search_bar (shell_content);
+
}
GType
@@ -1054,6 +1096,8 @@ e_shell_content_set_filter_action (EShellContent *shell_content,
EActionComboBox *combo_box;
g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+ if (!shell_content->priv->filter_combo_box)
+ return;
combo_box = E_ACTION_COMBO_BOX (shell_content->priv->filter_combo_box);
@@ -1102,6 +1146,8 @@ e_shell_content_set_filter_visible (EShellContent *shell_content,
gboolean filter_visible)
{
g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+ if (!shell_content->priv->filter_label || !shell_content->priv->filter_combo_box)
+ return;
if (filter_visible) {
gtk_widget_show (shell_content->priv->filter_label);
@@ -1240,6 +1286,8 @@ e_shell_content_set_search_visible (EShellContent *shell_content,
gboolean search_visible)
{
g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+ if (!shell_content->priv->search_label || !shell_content->priv->search_entry)
+ return;
if (search_visible) {
gtk_widget_show (shell_content->priv->search_label);
@@ -1269,6 +1317,8 @@ e_shell_content_set_scope_action (EShellContent *shell_content,
EActionComboBox *combo_box;
g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+ if (!shell_content->priv->scope_combo_box)
+ return;
combo_box = E_ACTION_COMBO_BOX (shell_content->priv->scope_combo_box);
@@ -1317,6 +1367,8 @@ e_shell_content_set_scope_visible (EShellContent *shell_content,
gboolean scope_visible)
{
g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+ if (!shell_content->priv->scope_label || shell_content->priv->scope_combo_box)
+ return;
if (scope_visible) {
gtk_widget_show (shell_content->priv->scope_label);
diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h
index 9449040..3e4af3b 100644
--- a/shell/e-shell-content.h
+++ b/shell/e-shell-content.h
@@ -78,6 +78,7 @@ struct _EShellContentClass {
ERuleContext * (*new_search_context) (void);
guint32 (*check_state) (EShellContent *shell_content);
+ void (*construct_search_bar) (EShellContent *shell_content);
};
GType e_shell_content_get_type (void);
@@ -142,6 +143,11 @@ void e_shell_content_run_save_search_dialog
(EShellContent *shell_content);
void e_shell_content_restore_state (EShellContent *shell_content,
const gchar *group_name);
+void e_shell_content_set_search_entry(EShellContent *shell_content,
+ GtkEntry *search_entry,
+ gboolean pack);
+void e_shell_content_show_search_bar (EShellContent *shell_content,
+ gboolean show);
G_END_DECLS
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
index c3d89d7..53c9d7a 100644
--- a/shell/e-shell-taskbar.c
+++ b/shell/e-shell-taskbar.c
@@ -435,3 +435,9 @@ e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar)
e_shell_taskbar_set_message (shell_taskbar, NULL);
}
+
+int
+e_shell_taskbar_get_task_count (EShellTaskbar *shell_taskbar)
+{
+ return g_hash_table_size(shell_taskbar->priv->proxy_table);
+}
diff --git a/shell/e-shell-taskbar.h b/shell/e-shell-taskbar.h
index 3c3d400..77576db 100644
--- a/shell/e-shell-taskbar.h
+++ b/shell/e-shell-taskbar.h
@@ -81,6 +81,7 @@ const gchar * e_shell_taskbar_get_message (EShellTaskbar *shell_taskbar);
void e_shell_taskbar_set_message (EShellTaskbar *shell_taskbar,
const gchar *message);
void e_shell_taskbar_unset_message (EShellTaskbar *shell_taskbar);
+int e_shell_taskbar_get_task_count (EShellTaskbar *shell_taskbar);
G_END_DECLS
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 4025a93..5ba8967 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -165,13 +165,83 @@ shell_window_online_button_clicked_cb (EOnlineButton *button,
}
void
+e_shell_window_private_pack_switcher (EShellWindow *shell_window)
+{
+ EShellWindowPrivate *priv = shell_window->priv;
+ GtkWidget *container;
+ GtkWidget *widget;
+
+ container = priv->content_pane;
+
+ widget = e_shell_switcher_new ();
+ gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, FALSE);
+ priv->switcher = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, FALSE);
+ priv->content_notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = priv->switcher;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->sidebar_notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+}
+
+void
+e_shell_window_private_pack_toolbar (EShellWindow *shell_window, GtkWidget *container)
+{
+ GtkWidget *widget;
+ EShellWindowPrivate *priv = shell_window->priv;
+ GtkToolItem *item;
+
+ widget = e_shell_window_get_managed_widget (
+ shell_window, "/main-toolbar");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ priv->main_toolbar = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* XXX Having this separator in the UI definition doesn't work
+ * because GtkUIManager is unaware of the "New" button, so
+ * it makes the separator invisible. One possibility is to
+ * define a GtkAction subclass for which create_tool_item()
+ * returns an EMenuToolButton. Then both this separator
+ * and the "New" button could be added to the UI definition.
+ * Tempting, but the "New" button and its dynamically
+ * generated menu is already a complex beast, and I'm not
+ * convinced having it proxy some new type of GtkAction
+ * is worth the extra effort. */
+ item = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ item = e_menu_tool_button_new (_("New"));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
+ gtk_widget_add_accelerator (
+ GTK_WIDGET (item), "clicked",
+ gtk_ui_manager_get_accel_group (priv->ui_manager),
+ GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
+ gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
+ priv->menu_tool_button = g_object_ref (item);
+ gtk_widget_show (GTK_WIDGET (item));
+
+}
+
+void
e_shell_window_private_init (EShellWindow *shell_window)
{
EShellWindowPrivate *priv = shell_window->priv;
GHashTable *loaded_views;
GArray *signal_handler_ids;
GtkAccelGroup *accel_group;
- GtkToolItem *item;
GtkWidget *container;
GtkWidget *widget;
guint merge_id;
@@ -231,35 +301,8 @@ e_shell_window_private_init (EShellWindow *shell_window)
priv->main_menu = g_object_ref (widget);
gtk_widget_show (widget);
- widget = e_shell_window_get_managed_widget (
- shell_window, "/main-toolbar");
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- priv->main_toolbar = g_object_ref (widget);
- gtk_widget_show (widget);
+ E_SHELL_WINDOW_GET_CLASS(shell_window)->construct_toolbar (shell_window, container);
- /* XXX Having this separator in the UI definition doesn't work
- * because GtkUIManager is unaware of the "New" button, so
- * it makes the separator invisible. One possibility is to
- * define a GtkAction subclass for which create_tool_item()
- * returns an EMenuToolButton. Then both this separator
- * and the "New" button could be added to the UI definition.
- * Tempting, but the "New" button and its dynamically
- * generated menu is already a complex beast, and I'm not
- * convinced having it proxy some new type of GtkAction
- * is worth the extra effort. */
- item = gtk_separator_tool_item_new ();
- gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
- gtk_widget_show (GTK_WIDGET (item));
-
- item = e_menu_tool_button_new (_("New"));
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
- gtk_widget_add_accelerator (
- GTK_WIDGET (item), "clicked",
- gtk_ui_manager_get_accel_group (priv->ui_manager),
- GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
- gtk_toolbar_insert (GTK_TOOLBAR (widget), item, 0);
- priv->menu_tool_button = g_object_ref (item);
- gtk_widget_show (GTK_WIDGET (item));
widget = gtk_hpaned_new ();
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
@@ -276,28 +319,8 @@ e_shell_window_private_init (EShellWindow *shell_window)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &height);
gtk_widget_set_size_request (widget, -1, (height * 2) + 6);
- container = priv->content_pane;
-
- widget = e_shell_switcher_new ();
- gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, FALSE);
- priv->switcher = g_object_ref (widget);
- gtk_widget_show (widget);
-
- widget = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
- gtk_paned_pack2 (GTK_PANED (container), widget, TRUE, FALSE);
- priv->content_notebook = g_object_ref (widget);
- gtk_widget_show (widget);
-
- container = priv->switcher;
-
- widget = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
- gtk_container_add (GTK_CONTAINER (container), widget);
- priv->sidebar_notebook = g_object_ref (widget);
- gtk_widget_show (widget);
+ /* Pack the content area */
+ E_SHELL_WINDOW_GET_CLASS(shell_window)->construct_content_area (shell_window);
container = priv->status_area;
@@ -581,7 +604,8 @@ e_shell_window_update_new_menu (EShellWindow *shell_window)
const gchar *path;
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
-
+ if (!shell_window->priv->menu_tool_button)
+ return;
/* Update the "File -> New" submenu. */
path = "/main-menu/file-menu/new-menu";
menu = e_shell_window_create_new_menu (shell_window);
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index c4f2e19..44047e6 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -123,6 +123,10 @@ void e_shell_window_update_new_menu (EShellWindow *shell_window);
void e_shell_window_update_view_menu (EShellWindow *shell_window);
void e_shell_window_update_search_menu
(EShellWindow *shell_window);
+void e_shell_window_private_pack_switcher
+ (EShellWindow *shell_window);
+void e_shell_window_private_pack_toolbar
+ (EShellWindow *shell_window, GtkWidget *container);
G_END_DECLS
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index a6ac570..74e6162 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -48,7 +48,7 @@ shell_window_new_view (EShellBackend *shell_backend,
GtkWidget *widget;
const gchar *name;
const gchar *id;
- gint page_num;
+ gint page_num=0;
GType type;
name = E_SHELL_BACKEND_GET_CLASS (shell_backend)->name;
@@ -58,8 +58,10 @@ shell_window_new_view (EShellBackend *shell_backend,
e_shell_backend_start (shell_backend);
/* Determine the page number for the new shell view. */
- notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
- page_num = gtk_notebook_get_n_pages (notebook);
+ if (shell_window->priv->content_notebook) {
+ notebook = GTK_NOTEBOOK (shell_window->priv->content_notebook);
+ page_num = gtk_notebook_get_n_pages (notebook);
+ }
/* Get the switcher action for this view. */
action = e_shell_window_get_shell_view_action (shell_window, name);
@@ -265,6 +267,18 @@ shell_window_constructed (GObject *object)
}
static void
+shell_construct_content_area (EShellWindow *shell_window)
+{
+ e_shell_window_private_pack_switcher(shell_window);
+}
+
+static void
+shell_construct_toolbar (EShellWindow *shell_window, GtkWidget *container)
+{
+ e_shell_window_private_pack_toolbar(shell_window, container);
+}
+
+static void
shell_window_class_init (EShellWindowClass *class)
{
GObjectClass *object_class;
@@ -279,6 +293,10 @@ shell_window_class_init (EShellWindowClass *class)
object_class->finalize = shell_window_finalize;
object_class->constructed = shell_window_constructed;
+ class->construct_content_area = shell_construct_content_area;
+ class->construct_toolbar = shell_construct_toolbar;
+
+
/**
* EShellWindow:active-view
*
@@ -346,7 +364,7 @@ static void
shell_window_init (EShellWindow *shell_window)
{
shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window);
-
+
e_shell_window_private_init (shell_window);
}
@@ -881,3 +899,9 @@ e_shell_window_register_new_source_actions (EShellWindow *shell_window,
e_shell_window_update_new_menu (shell_window);
}
+
+GtkWidget *
+e_shell_window_get_status_area (EShellWindow *shell_window)
+{
+ return shell_window->priv->status_area;
+}
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index b867490..339cc7f 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -71,6 +71,9 @@ struct _EShellWindow {
struct _EShellWindowClass {
GtkWindowClass parent_class;
+
+ void (*construct_toolbar) (EShellWindow *, GtkWidget *container);
+ void (*construct_content_area) (EShellWindow *);
};
GType e_shell_window_get_type (void);
@@ -112,6 +115,7 @@ void e_shell_window_register_new_source_actions
const gchar *backend_name,
GtkActionEntry *entries,
guint n_entries);
+GtkWidget * e_shell_window_get_status_area (EShellWindow *shell_window);
G_END_DECLS
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6224021..ff9ecc2 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -37,6 +37,8 @@
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL, EShellPrivate))
+const char *shell_moduledir = EVOLUTION_MODULEDIR;
+
struct _EShellPrivate {
GList *watched_windows;
EShellSettings *settings;
@@ -364,7 +366,7 @@ shell_load_modules (EShell *shell)
GList *modules;
/* Load all shared library modules. */
- modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
+ modules = e_module_load_all_in_directory (shell_moduledir);
while (modules != NULL) {
g_type_module_unuse (G_TYPE_MODULE (modules->data));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]