aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-browser.c17
-rw-r--r--mail/e-mail-reader-utils.c67
-rw-r--r--mail/e-mail-reader.c272
-rw-r--r--mail/e-mail-reader.h12
-rw-r--r--mail/e-mail-store.c6
-rw-r--r--mail/em-utils.c16
-rw-r--r--mail/mail-mt.c10
-rw-r--r--mail/mail-send-recv.c2
8 files changed, 231 insertions, 171 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index e605e27267..e0d6aa9e16 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -193,8 +193,9 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
const gchar *uid)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelMessageInfo *info;
+ CamelFolder *folder;
EMailReader *reader;
if (uid == NULL)
@@ -203,7 +204,9 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
reader = E_MAIL_READER (browser);
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- info = camel_folder_get_message_info (message_list->folder, uid);
+
+ folder = MESSAGE_LIST (message_list)->folder;
+ info = camel_folder_get_message_info (folder, uid);
if (info == NULL)
return;
@@ -214,7 +217,7 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
gtk_widget_grab_focus (
GTK_WIDGET (((EMFormatHTML *) html_display)->html));
- camel_folder_free_message_info (message_list->folder, info);
+ camel_folder_free_message_info (folder, info);
}
static gboolean
@@ -558,14 +561,14 @@ mail_browser_get_html_display (EMailReader *reader)
return priv->html_display;
}
-static MessageList *
+static GtkWidget *
mail_browser_get_message_list (EMailReader *reader)
{
EMailBrowserPrivate *priv;
priv = E_MAIL_BROWSER_GET_PRIVATE (reader);
- return MESSAGE_LIST (priv->message_list);
+ return priv->message_list;
}
static GtkMenu *
@@ -603,7 +606,7 @@ mail_browser_set_message (EMailReader *reader,
const gchar *uid)
{
EMailReaderIface *iface;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelMessageInfo *info;
CamelFolder *folder;
@@ -618,7 +621,7 @@ mail_browser_set_message (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
info = camel_folder_get_message_info (folder, uid);
if (info != NULL) {
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index e7a294f349..f1ef1034b1 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,
@@ -64,10 +65,10 @@ e_mail_reader_confirm_delete (EMailReader *reader)
EShell *shell;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
- MessageList *message_list;
CamelFolder *folder;
GtkWidget *check_button;
GtkWidget *content_area;
+ GtkWidget *message_list;
GtkWidget *dialog;
GtkWindow *window;
const gchar *label;
@@ -85,7 +86,7 @@ e_mail_reader_confirm_delete (EMailReader *reader)
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
prompt_delete_in_vfolder = e_shell_settings_get_boolean (
shell_settings, "mail-prompt-delete-in-vfolder");
@@ -130,7 +131,7 @@ e_mail_reader_mark_as_read (EMailReader *reader,
const gchar *uid)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
guint32 mask, set;
guint32 flags;
@@ -141,7 +142,7 @@ e_mail_reader_mark_as_read (EMailReader *reader,
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
flags = camel_folder_get_message_flags (folder, uid);
if (!(flags & CAMEL_MESSAGE_SEEN)) {
@@ -161,7 +162,7 @@ e_mail_reader_mark_selected (EMailReader *reader,
guint32 mask,
guint32 set)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GPtrArray *uids;
guint ii;
@@ -170,18 +171,18 @@ e_mail_reader_mark_selected (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
if (folder == NULL)
return 0;
camel_folder_freeze (folder);
- uids = message_list_get_selected (message_list);
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
for (ii = 0; ii < uids->len; ii++)
camel_folder_set_message_flags (
folder, uids->pdata[ii], mask, set);
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
camel_folder_thaw (folder);
return ii;
@@ -191,7 +192,7 @@ guint
e_mail_reader_open_selected (EMailReader *reader)
{
EShellBackend *shell_backend;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *views;
@@ -205,12 +206,12 @@ e_mail_reader_open_selected (EMailReader *reader)
shell_backend = e_mail_reader_get_shell_backend (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
if (!em_utils_ask_open_many (window, uids->len)) {
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
return 0;
}
@@ -273,7 +274,7 @@ e_mail_reader_open_selected (EMailReader *reader)
g_ptr_array_free (views, TRUE);
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
return ii;
}
@@ -282,7 +283,7 @@ void
e_mail_reader_print (EMailReader *reader,
GtkPrintOperationAction action)
{
- MessageList *message_list;
+ GtkWidget *message_list;
EMFormatHTMLDisplay *html_display;
EMFormatHTMLPrint *html_print;
CamelFolder *folder;
@@ -293,11 +294,11 @@ e_mail_reader_print (EMailReader *reader,
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
g_return_if_fail (folder != NULL);
/* XXX Learn to handle len > 1. */
- uids = message_list_get_selected (message_list);
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
if (uids->len != 1)
goto exit;
@@ -310,7 +311,7 @@ e_mail_reader_print (EMailReader *reader,
g_object_unref (html_print);
exit:
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
/* Helper for e_mail_reader_reply_to_message()
@@ -361,7 +362,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
gint reply_mode)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelMimeMessage *new_message;
CamelMimeMessage *src_message;
CamelFolder *folder;
@@ -384,8 +385,8 @@ e_mail_reader_reply_to_message (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- uid = message_list->cursor_uid;
+ folder = MESSAGE_LIST (message_list)->folder;
+ uid = MESSAGE_LIST (message_list)->cursor_uid;
g_return_if_fail (uid != NULL);
if (!gtk_html_command (html, "is-selection-active"))
@@ -437,7 +438,7 @@ void
e_mail_reader_select_next_message (EMailReader *reader,
gboolean or_else_previous)
{
- MessageList *message_list;
+ GtkWidget *message_list;
gboolean hide_deleted;
gboolean success;
@@ -447,11 +448,13 @@ e_mail_reader_select_next_message (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
success = message_list_select (
- message_list, MESSAGE_LIST_SELECT_NEXT, 0, 0);
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_NEXT, 0, 0);
if (!success && (hide_deleted || or_else_previous))
message_list_select (
- message_list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0);
+ MESSAGE_LIST (message_list),
+ MESSAGE_LIST_SELECT_PREVIOUS, 0, 0);
}
/* Helper for e_mail_reader_create_filter_from_selected() */
@@ -477,7 +480,7 @@ void
e_mail_reader_create_filter_from_selected (EMailReader *reader,
gint filter_type)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
const gchar *filter_source;
const gchar *folder_uri;
@@ -492,8 +495,8 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
if (em_utils_folder_is_sent (folder, folder_uri))
filter_source = E_FILTER_SOURCE_OUTGOING;
@@ -502,7 +505,7 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader,
else
filter_source = E_FILTER_SOURCE_INCOMING;
- uids = message_list_get_selected (message_list);
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
if (uids->len == 1) {
filter_data = g_malloc (sizeof (*filter_data));
@@ -542,7 +545,7 @@ void
e_mail_reader_create_vfolder_from_selected (EMailReader *reader,
gint vfolder_type)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
const gchar *folder_uri;
GPtrArray *uids;
@@ -556,10 +559,10 @@ e_mail_reader_create_vfolder_from_selected (EMailReader *reader,
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
- uids = message_list_get_selected (message_list);
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
if (uids->len == 1) {
vfolder_data = g_malloc (sizeof (*vfolder_data));
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index f70b32af6a..346b03c056 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -48,6 +48,7 @@
#include "mail/mail-config.h"
#include "mail/mail-ops.h"
#include "mail/mail-vfolder.h"
+#include "mail/message-list.h"
enum {
CHANGED,
@@ -68,7 +69,7 @@ action_mail_add_sender_cb (GtkAction *action,
{
EShell *shell;
EShellBackend *shell_backend;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelMessageInfo *info;
CamelFolder *folder;
GPtrArray *uids;
@@ -77,8 +78,8 @@ action_mail_add_sender_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
shell_backend = e_mail_reader_get_shell_backend (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
if (uids->len != 1)
goto exit;
@@ -158,14 +159,14 @@ static void
action_mail_check_for_junk_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GPtrArray *uids;
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
mail_filter_junk (folder, uids);
}
@@ -187,7 +188,7 @@ static void
action_mail_copy_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWidget *folder_tree;
GtkWidget *dialog;
@@ -199,9 +200,9 @@ action_mail_copy_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
folder_tree = em_folder_tree_new ();
- selected = message_list_get_selected (message_list);
+ selected = message_list_get_selected (MESSAGE_LIST (message_list));
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
em_folder_tree_set_excluded (
EM_FOLDER_TREE (folder_tree),
@@ -289,14 +290,14 @@ static void
action_mail_filters_apply_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GPtrArray *uids;
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
mail_filter_on_demand (folder, uids);
}
@@ -313,7 +314,7 @@ action_mail_flag_clear_cb (GtkAction *action,
EMailReader *reader)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -322,8 +323,8 @@ action_mail_flag_clear_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
em_utils_flag_for_followup_clear (window, folder, uids);
@@ -335,7 +336,7 @@ action_mail_flag_completed_cb (GtkAction *action,
EMailReader *reader)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -344,8 +345,8 @@ action_mail_flag_completed_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
em_utils_flag_for_followup_completed (window, folder, uids);
@@ -356,7 +357,7 @@ static void
action_mail_flag_for_followup_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -364,8 +365,8 @@ action_mail_flag_for_followup_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
em_utils_flag_for_followup (reader, folder, uids);
}
@@ -374,7 +375,7 @@ static void
action_mail_forward_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -383,22 +384,22 @@ action_mail_forward_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids != NULL);
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_messages (folder, uids, folder_uri);
else
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
action_mail_forward_attached_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -407,22 +408,22 @@ action_mail_forward_attached_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids != NULL);
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_attached (folder, uids, folder_uri);
else
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
action_mail_forward_inline_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -431,22 +432,22 @@ action_mail_forward_inline_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids != NULL);
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_inline (folder, uids, folder_uri);
else
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
action_mail_forward_quoted_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -455,15 +456,15 @@ action_mail_forward_quoted_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids != NULL);
if (em_utils_ask_open_many (window, uids->len))
em_utils_forward_quoted (folder, uids, folder_uri);
else
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
@@ -536,7 +537,7 @@ static void
action_mail_mark_unread_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
guint32 mask = CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED;
guint32 set = 0;
@@ -544,9 +545,9 @@ action_mail_mark_unread_cb (GtkAction *action,
e_mail_reader_mark_selected (reader, mask, set);
- if (message_list->seen_id != 0) {
- g_source_remove (message_list->seen_id);
- message_list->seen_id = 0;
+ if (MESSAGE_LIST (message_list)->seen_id != 0) {
+ g_source_remove (MESSAGE_LIST (message_list)->seen_id);
+ MESSAGE_LIST (message_list)->seen_id = 0;
}
}
@@ -554,7 +555,7 @@ static void
action_mail_message_edit_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
GPtrArray *uids;
@@ -562,8 +563,8 @@ action_mail_message_edit_cb (GtkAction *action,
window = e_mail_reader_get_window (reader);
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
em_utils_edit_messages (folder, uids, FALSE);
}
@@ -572,13 +573,14 @@ static void
action_mail_message_new_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
- GtkWindow *window;
+ GtkWidget *message_list;
+ const gchar *folder_uri;
message_list = e_mail_reader_get_message_list (reader);
- window = e_mail_reader_get_window (reader);
- em_utils_compose_new_message (message_list->folder_uri);
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+
+ em_utils_compose_new_message (folder_uri);
}
static void
@@ -592,7 +594,7 @@ static void
action_mail_move_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWidget *folder_tree;
GtkWidget *dialog;
@@ -604,9 +606,9 @@ action_mail_move_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
folder_tree = em_folder_tree_new ();
- selected = message_list_get_selected (message_list);
+ selected = message_list_get_selected (MESSAGE_LIST (message_list));
- folder = message_list->folder;
+ folder = MESSAGE_LIST (message_list)->folder;
em_folder_tree_set_excluded (
EM_FOLDER_TREE (folder_tree),
@@ -649,7 +651,7 @@ static void
action_mail_next_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -658,14 +660,16 @@ action_mail_next_cb (GtkAction *action,
mask = 0;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
action_mail_next_important_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -674,24 +678,27 @@ action_mail_next_important_cb (GtkAction *action,
mask = CAMEL_MESSAGE_FLAGGED;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
action_mail_next_thread_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select_next_thread (message_list);
+
+ message_list_select_next_thread (MESSAGE_LIST (message_list));
}
static void
action_mail_next_unread_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -700,14 +707,16 @@ action_mail_next_unread_cb (GtkAction *action,
mask = CAMEL_MESSAGE_SEEN;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
action_mail_previous_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -716,14 +725,16 @@ action_mail_previous_cb (GtkAction *action,
mask = 0;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
action_mail_previous_important_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -732,14 +743,16 @@ action_mail_previous_important_cb (GtkAction *action,
mask = CAMEL_MESSAGE_FLAGGED;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
action_mail_previous_unread_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
MessageListSelectDirection direction;
guint32 flags, mask;
@@ -748,7 +761,9 @@ action_mail_previous_unread_cb (GtkAction *action,
mask = CAMEL_MESSAGE_SEEN;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select (message_list, direction, flags, mask);
+
+ message_list_select (
+ MESSAGE_LIST (message_list), direction, flags, mask);
}
static void
@@ -775,7 +790,7 @@ static void
action_mail_redirect_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWindow *window;
const gchar *uid;
@@ -783,8 +798,8 @@ action_mail_redirect_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
window = e_mail_reader_get_window (reader);
- folder = message_list->folder;
- uid = message_list->cursor_uid;
+ folder = MESSAGE_LIST (message_list)->folder;
+ uid = MESSAGE_LIST (message_list)->cursor_uid;
g_return_if_fail (uid != NULL);
em_utils_redirect_message_by_uid (folder, uid);
@@ -817,7 +832,7 @@ action_mail_save_as_cb (GtkAction *action,
{
EShell *shell;
EShellBackend *shell_backend;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelMessageInfo *info;
CamelFolder *folder;
GPtrArray *uids;
@@ -830,8 +845,8 @@ action_mail_save_as_cb (GtkAction *action,
shell_backend = e_mail_reader_get_shell_backend (reader);
shell = e_shell_backend_get_shell (shell_backend);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids->len > 0);
title = ngettext ("Save Message", "Save Messages", uids->len);
@@ -932,7 +947,7 @@ action_mail_show_source_cb (GtkAction *action,
{
EMFormatHTMLDisplay *html_display;
EShellBackend *shell_backend;
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GtkWidget *browser;
GPtrArray *uids;
@@ -941,9 +956,9 @@ action_mail_show_source_cb (GtkAction *action,
message_list = e_mail_reader_get_message_list (reader);
shell_backend = e_mail_reader_get_shell_backend (reader);
- folder = message_list->folder;
- folder_uri = message_list->folder_uri;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
g_return_if_fail (uids->len > 0);
browser = e_mail_browser_new (shell_backend);
@@ -954,22 +969,22 @@ action_mail_show_source_cb (GtkAction *action,
e_mail_reader_set_message (reader, uids->pdata[0]);
gtk_widget_show (browser);
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
action_mail_toggle_important_cb (GtkAction *action,
EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
CamelFolder *folder;
GPtrArray *uids;
guint ii;
message_list = e_mail_reader_get_message_list (reader);
- folder = message_list->folder;
- uids = message_list_get_selected (message_list);
+ folder = MESSAGE_LIST (message_list)->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
camel_folder_freeze (folder);
@@ -988,7 +1003,7 @@ action_mail_toggle_important_cb (GtkAction *action,
camel_folder_thaw (folder);
- message_list_free_uids (message_list, uids);
+ message_list_free_uids (MESSAGE_LIST (message_list), uids);
}
static void
@@ -1045,7 +1060,7 @@ action_search_folder_recipient_cb (GtkAction *action,
EMailReader *reader)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
EWebView *web_view;
CamelURL *curl;
const gchar *uri;
@@ -1070,7 +1085,7 @@ action_search_folder_recipient_cb (GtkAction *action,
/* Ensure vfolder is running. */
vfolder_load_storage ();
- folder_uri = message_list->folder_uri;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
inet_addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
@@ -1086,7 +1101,7 @@ action_search_folder_sender_cb (GtkAction *action,
EMailReader *reader)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
EWebView *web_view;
CamelURL *curl;
const gchar *uri;
@@ -1111,7 +1126,7 @@ action_search_folder_sender_cb (GtkAction *action,
/* Ensure vfolder is running. */
vfolder_load_storage ();
- folder_uri = message_list->folder_uri;
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
inet_addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path);
@@ -1790,7 +1805,8 @@ mail_reader_key_press_cb (EMailReader *reader,
static gboolean
mail_reader_message_read_cb (EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
+ const gchar *cursor_uid;
const gchar *uid;
message_list = e_mail_reader_get_message_list (reader);
@@ -1798,7 +1814,9 @@ mail_reader_message_read_cb (EMailReader *reader)
uid = g_object_get_data (G_OBJECT (reader), "mark-read-uid");
g_return_val_if_fail (uid != NULL, FALSE);
- if (g_strcmp0 (message_list->cursor_uid, uid) == 0)
+ cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
+
+ if (g_strcmp0 (cursor_uid, uid) == 0)
e_mail_reader_mark_as_read (reader, uid);
return FALSE;
@@ -1813,12 +1831,13 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
{
EMailReader *reader = user_data;
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
EShellBackend *shell_backend;
EShellSettings *shell_settings;
EShell *shell;
EMEvent *event;
EMEventTargetMessage *target;
+ const gchar *cursor_uid;
gboolean mark_read;
gint timeout_interval;
@@ -1829,9 +1848,11 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
+ cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
+
/* If the user picked a different message in the time it took
* to fetch this message, then don't bother rendering it. */
- if (g_strcmp0 (message_list->cursor_uid, message_uid) != 0)
+ if (g_strcmp0 (cursor_uid, message_uid) != 0)
return;
/** @Event: message.reading
@@ -1863,11 +1884,11 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
G_OBJECT (reader), "mark-read-uid",
g_strdup (message_uid), (GDestroyNotify) g_free);
- if (message_list->seen_id > 0)
- g_source_remove (message_list->seen_id);
+ if (MESSAGE_LIST (message_list)->seen_id > 0)
+ g_source_remove (MESSAGE_LIST (message_list)->seen_id);
if (message != NULL && mark_read) {
- message_list->seen_id = g_timeout_add (
+ MESSAGE_LIST (message_list)->seen_id = g_timeout_add (
timeout_interval, (GSourceFunc)
mail_reader_message_read_cb, reader);
@@ -1896,7 +1917,7 @@ static gboolean
mail_reader_message_selected_timeout_cb (EMailReader *reader)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
const gchar *cursor_uid;
const gchar *format_uid;
const gchar *key;
@@ -1904,10 +1925,10 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- cursor_uid = message_list->cursor_uid;
+ cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
format_uid = EM_FORMAT (html_display)->uid;
- if (message_list->last_sel_single) {
+ if (MESSAGE_LIST (message_list)->last_sel_single) {
GtkWidget *widget;
gboolean html_display_visible;
gboolean selected_uid_changed;
@@ -1923,12 +1944,16 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
gint op_id;
op_id = mail_get_messagex (
- message_list->folder, cursor_uid,
+ MESSAGE_LIST (message_list)->folder,
+ cursor_uid,
mail_reader_message_loaded_cb,
g_object_ref (reader),
mail_msg_fast_ordered_push);
- g_object_set_data (G_OBJECT (reader), "preview-get-message-op-id", GINT_TO_POINTER (op_id));
+ g_object_set_data (
+ G_OBJECT (reader),
+ "preview-get-message-op-id",
+ GINT_TO_POINTER (op_id));
}
} else
em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
@@ -1945,12 +1970,13 @@ mail_reader_message_selected_cb (EMailReader *reader,
{
GSource *source;
const gchar *key;
- gint op_id;
+ gpointer data;
- /* cancel previous message fetching, if any, first */
- op_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (reader), "preview-get-message-op-id"));
- if (op_id)
- mail_msg_cancel (op_id);
+ /* First cancel any previous message fetching. */
+ key = "preview-get-message-op-id";
+ data = g_object_get_data (G_OBJECT (reader), key);
+ if (data != NULL)
+ mail_msg_cancel (GPOINTER_TO_INT (data));
/* XXX This is kludgy, but we have no other place to store timeout
* state information. Addendum: See EAttachmentView for an example
@@ -1987,17 +2013,18 @@ mail_reader_set_folder (EMailReader *reader,
const gchar *folder_uri)
{
EMFormatHTMLDisplay *html_display;
- MessageList *message_list;
+ GtkWidget *message_list;
gboolean outgoing;
html_display = e_mail_reader_get_html_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- if (message_list->folder != NULL)
- mail_sync_folder (message_list->folder, NULL, NULL);
+ if (MESSAGE_LIST (message_list)->folder != NULL)
+ mail_sync_folder (
+ MESSAGE_LIST (message_list)->folder, NULL, NULL);
/* Skip the rest if we're already viewing the folder. */
- if (g_strcmp0 (folder_uri, message_list->folder_uri) == 0)
+ if (g_strcmp0 (folder_uri, MESSAGE_LIST (message_list)->folder_uri) == 0)
return;
outgoing = folder != NULL && folder_uri != NULL && (
@@ -2006,7 +2033,9 @@ mail_reader_set_folder (EMailReader *reader,
em_utils_folder_is_sent (folder, folder_uri));
em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL);
- message_list_set_folder (message_list, folder, folder_uri, outgoing);
+
+ message_list_set_folder (
+ MESSAGE_LIST (message_list), folder, folder_uri, outgoing);
mail_reader_emit_folder_loaded (reader);
}
@@ -2015,10 +2044,11 @@ static void
mail_reader_set_message (EMailReader *reader,
const gchar *uid)
{
- MessageList *message_list;
+ GtkWidget *message_list;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select_uid (message_list, uid);
+
+ message_list_select_uid (MESSAGE_LIST (message_list), uid);
}
static void
@@ -2463,7 +2493,7 @@ e_mail_reader_init (EMailReader *reader)
EMenuToolAction *menu_tool_action;
EWebView *web_view;
GtkActionGroup *action_group;
- MessageList *message_list;
+ GtkWidget *message_list;
GConfBridge *bridge;
GtkAction *action;
const gchar *action_name;
@@ -2620,15 +2650,15 @@ e_mail_reader_init (EMailReader *reader)
G_CALLBACK (mail_reader_emit_folder_loaded), reader);
g_signal_connect_swapped (
- message_list->tree, "double-click",
+ MESSAGE_LIST (message_list)->tree, "double-click",
G_CALLBACK (mail_reader_double_click_cb), reader);
g_signal_connect_swapped (
- message_list->tree, "key-press",
+ MESSAGE_LIST (message_list)->tree, "key-press",
G_CALLBACK (mail_reader_key_press_cb), reader);
g_signal_connect_swapped (
- message_list->tree, "selection-change",
+ MESSAGE_LIST (message_list)->tree, "selection-change",
G_CALLBACK (e_mail_reader_changed), reader);
}
@@ -2643,7 +2673,7 @@ e_mail_reader_changed (EMailReader *reader)
guint32
e_mail_reader_check_state (EMailReader *reader)
{
- MessageList *message_list;
+ GtkWidget *message_list;
GPtrArray *uids;
CamelFolder *folder;
CamelStore *store = NULL;
@@ -2669,9 +2699,9 @@ e_mail_reader_check_state (EMailReader *reader)
g_return_val_if_fail (E_IS_MAIL_READER (reader), 0);
message_list = e_mail_reader_get_message_list (reader);
- uids = message_list_get_selected (message_list);
- folder_uri = message_list->folder_uri;
- folder = message_list->folder;
+ uids = message_list_get_selected (MESSAGE_LIST (message_list));
+ folder_uri = MESSAGE_LIST (message_list)->folder_uri;
+ folder = MESSAGE_LIST (message_list)->folder;
if (folder != NULL) {
store = CAMEL_STORE (folder->parent_store);
@@ -2865,7 +2895,7 @@ e_mail_reader_get_html_display (EMailReader *reader)
return iface->get_html_display (reader);
}
-MessageList *
+GtkWidget *
e_mail_reader_get_message_list (EMailReader *reader)
{
EMailReaderIface *iface;
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index e9f9a3a9e4..122d11fb88 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -22,10 +22,16 @@
#ifndef E_MAIL_READER_H
#define E_MAIL_READER_H
+/* XXX Anjal uses a different message list widget than Evolution, so
+ * avoid including <mail/message-list.h> in this file. This makes
+ * the get_message_list() method a little awkward since it returns
+ * a GtkWidget pointer which almost always has to be type casted.
+ * Consider adding get_folder() and get_folder_uri() methods to
+ * take some pressure off get_message_list(). */
+
#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 */
@@ -82,7 +88,7 @@ struct _EMailReaderIface {
gboolean (*get_hide_deleted) (EMailReader *reader);
EMFormatHTMLDisplay *
(*get_html_display) (EMailReader *reader);
- MessageList * (*get_message_list) (EMailReader *reader);
+ GtkWidget * (*get_message_list) (EMailReader *reader);
GtkMenu * (*get_popup_menu) (EMailReader *reader);
EShellBackend * (*get_shell_backend) (EMailReader *reader);
GtkWindow * (*get_window) (EMailReader *reader);
@@ -110,7 +116,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);
+GtkWidget * 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 1fc3eb5b25..749459d462 100644
--- a/mail/e-mail-store.c
+++ b/mail/e-mail-store.c
@@ -264,9 +264,13 @@ e_mail_store_init (const gchar *data_dir)
{
static gboolean initialized = FALSE;
- g_return_if_fail (!initialized);
g_return_if_fail (data_dir != NULL);
+ /* This function is idempotent, but there should
+ * be no need to call it more than once. */
+ if (initialized)
+ return;
+
/* Initialize global variables. */
store_table = g_hash_table_new_full (
diff --git a/mail/em-utils.c b/mail/em-utils.c
index cb8ebc3306..1238fcf2e5 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -79,6 +79,10 @@
#include "em-format-quote.h"
#include "e-mail-local.h"
+/* XXX This is a dirty hack on a dirty hack. We really need
+ * to rework or get rid of the functions that use this. */
+extern const gchar *shell_builtin_backend;
+
/* How many is too many? */
/* Used in em_util_ask_open_many() */
#define TOO_MANY 10
@@ -97,7 +101,8 @@ 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);
}
@@ -112,7 +117,8 @@ 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);
}
@@ -2074,7 +2080,8 @@ 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);
@@ -2094,7 +2101,8 @@ 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 ff7a30e97c..2c06561770 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -46,6 +46,10 @@
/*#define MALLOC_CHECK*/
#define d(x)
+/* XXX This is a dirty hack on a dirty hack. We really need
+ * to rework or get rid of the functions that use this. */
+const gchar *shell_builtin_backend = "mail";
+
static void mail_operation_status(CamelOperation *op, const gchar *what, gint pc, gpointer data);
/* background operation status stuff */
@@ -96,7 +100,8 @@ 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 +851,8 @@ 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);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 1495f09ed4..b5e135c227 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) {