aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:52:05 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:52:05 +0800
commit85b2913a380c69f14ae0254ad23b10fabfb33667 (patch)
treec1cf143e37294dd9dd3667ebbe0a1d0c00b04b56 /mail
parente7a31c5035a0afeed6c1675e30487c1e2bdc139f (diff)
downloadgsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.gz
gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.zst
gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.zip
Merge revisions 36534:36684 from trunk.
svn path=/branches/kill-bonobo/; revision=36685
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog56
-rw-r--r--mail/em-folder-browser.c30
-rw-r--r--mail/em-folder-view.c5
-rw-r--r--mail/em-utils.c80
-rw-r--r--mail/mail-component.h2
-rw-r--r--mail/mail-send-recv.c28
-rw-r--r--mail/mail-send-recv.h25
-rw-r--r--mail/mail-session.c4
-rw-r--r--mail/mail-vfolder.c15
-rw-r--r--mail/message-list.c16
-rw-r--r--mail/message-list.h1
11 files changed, 222 insertions, 40 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index d8d68f1a4a..a5a277b527 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,59 @@
+2008-10-22 Matthew Barnes <mbarnes@redhat.com>
+
+ * mail-send-recv.c:
+ * mail-send-recv.h:
+ Just some minor code polishing.
+
+2008-10-21 Sankar P <psankar@novell.com>
+
+ * em-folder-view.c (emfv_spin):
+ Re-factor spinner usage
+
+2008-10-20 Patrick Ohly <Patrick.Ohly@gmx.de>
+
+ * mail-component.h: Fixed a build break.
+
+2008-10-19 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #438155
+
+ * message-list.h: (struct _MessageList):
+ * message-list.c: (message_list_init), (message_list_finalise),
+ (regen_list_done), (regen_list_free), (ml_regen_timeout),
+ (mail_regen_cancel): Guard access to the 'regen' list with a lock.
+
+2008-10-17 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #555276
+
+ * mail/mail-vfolder.c: Don't load a vfolder as a sub folder.
+
+2008-10-17 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #364542
+
+ * em-utils.c: (struct TryOpenEBookStruct), (try_open_e_book_cb),
+ (try_open_e_book), (em_utils_in_addressbook), (em_utils_contact_photo):
+ Stop when camel operation has been canceled. Also check for
+ cancellation when opening EBook, thus the UI (preview) will
+ not freeze with slow address books.
+
+2008-10-07 Bharath Acharya <abharath@novell.com>
+
+ ** Fix for bug #555203
+
+ * mail-session.c: (get_password): Use the url value in cases where the
+ account goes NULL. Fixes the issue of Exchange not sending mails,
+ because it does not have a valid transport url to use.
+
+2008-10-05 Sankar P <psankar@novell.com>
+
+ ** Fix for bug #554349
+
+ * mail/em-folder-browser.c:
+ Expand threads and select messages,
+ if user has given select-all.
+
2008-10-01 Milan Crha <mcrha@redhat.com>
** Part of fix for bug #554418
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 159d77d557..3bfb198c2b 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -149,6 +149,8 @@ static void emfb_search_search_cleared(ESearchBar *esb);
static int emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb);
static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb);
+static void emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path);
+
static const EMFolderViewEnable emfb_enable_map[] = {
{ "EditInvertSelection", EM_POPUP_SELECT_FOLDER },
{ "EditSelectAll", EM_POPUP_SELECT_FOLDER },
@@ -1426,13 +1428,35 @@ emfb_edit_invert_selection(BonoboUIComponent *uid, void *data, const char *path)
message_list_invert_selection(emfv->list);
}
+static gboolean
+emfb_select_all_daemon (MessageList *ml)
+{
+ message_list_select_all(ml);
+ gtk_widget_grab_focus ((GtkWidget *)ml);
+ return FALSE;
+}
+
static void
emfb_edit_select_all(BonoboUIComponent *uid, void *data, const char *path)
{
- EMFolderView *emfv = data;
+ EMFolderView *emfv = data;
- message_list_select_all(emfv->list);
- gtk_widget_grab_focus ((GtkWidget *)emfv->list);
+ if (emfv->list->threaded) {
+
+ emfb_expand_all_threads (uid, data, path);
+
+ /* The time out below is added so that the execution thread to
+ expand all conversations threads would've completed.
+
+ The timeout 505 is just to ensure that the value is a small delta
+ more than the timeout value in expand_all_threads thread. */
+
+ g_timeout_add (505, (GSourceFunc) emfb_select_all_daemon, emfv->list);
+
+ } else {
+ /* If there is no threading, just select-all immediately */
+ emfb_select_all_daemon (emfv->list);
+ }
}
static void
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 2e673fde84..87d5196dcc 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2539,10 +2539,7 @@ emfv_spin(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
box = gtk_hbox_new (FALSE, 0);
g_free (msg);
- ep = e_spinner_new ();
- e_spinner_set_size ((ESpinner *)ep, GTK_ICON_SIZE_SMALL_TOOLBAR);
- e_spinner_start ((ESpinner *)ep);
-
+ ep = e_spinner_new_spinning_small_shown ();
gtk_box_pack_start ((GtkBox *)box, ep, FALSE, FALSE, 0);
gtk_box_pack_start ((GtkBox *)box, label, FALSE, FALSE, 0);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 8db127e5ed..b5c629ad1f 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -63,6 +63,7 @@
#include "message-tag-followup.h"
#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-flag.h>
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
#include "e-util/e-mktemp.h"
@@ -2045,6 +2046,72 @@ emu_addr_cancel_book(void *data)
g_clear_error(&err);
}
+struct TryOpenEBookStruct {
+ GError **error;
+ EFlag *flag;
+ gboolean result;
+};
+
+static void
+try_open_e_book_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ struct TryOpenEBookStruct *data = (struct TryOpenEBookStruct *)closure;
+
+ if (!data)
+ return;
+
+ data->result = status == E_BOOK_ERROR_OK;
+
+ if (!data->result)
+ g_set_error (data->error, E_BOOK_ERROR, status, "EBookStatus returned %d", status);
+
+ e_flag_set (data->flag);
+}
+
+/**
+ * try_open_e_book:
+ * Tries to open address book asynchronously, but acts as synchronous.
+ * The advantage is it checks periodically whether the camel_operation
+ * has been canceled or not, and if so, then stops immediately, with
+ * result FALSE. Otherwise returns same as e_book_open
+ **/
+static gboolean
+try_open_e_book (EBook *book, gboolean only_if_exists, GError **error)
+{
+ struct TryOpenEBookStruct data;
+ gboolean canceled = FALSE;
+ EFlag *flag = e_flag_new ();
+
+ data.error = error;
+ data.flag = flag;
+ data.result = FALSE;
+
+ if (e_book_async_open (book, only_if_exists, try_open_e_book_cb, &data) != FALSE) {
+ e_flag_free (flag);
+ g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_OTHER_ERROR, "Failed to call e_book_async_open.");
+ return FALSE;
+ }
+
+ while (canceled = camel_operation_cancel_check (NULL), !canceled && !e_flag_is_set (flag)) {
+ GTimeVal wait;
+
+ g_get_current_time (&wait);
+ g_time_val_add (&wait, 250000); /* waits 250ms */
+
+ e_flag_timed_wait (flag, &wait);
+ }
+
+ e_flag_free (flag);
+
+ if (canceled) {
+ g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, "Operation has been canceled.");
+ e_book_cancel_async_op (book, NULL);
+ return FALSE;
+ }
+
+ return data.result;
+}
+
gboolean
em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only)
{
@@ -2131,9 +2198,9 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only)
hook = mail_cancel_hook_add(emu_addr_cancel_book, book);
/* ignore errors, but cancellation errors we don't try to go further either */
- if (!e_book_open(book, TRUE, &err)
+ if (!try_open_e_book (book, TRUE, &err)
|| !e_book_get_contacts(book, query, &contacts, &err)) {
- stop = err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED;
+ stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED;
mail_cancel_hook_remove(hook);
g_object_unref(book);
d(g_warning("Can't get contacts: %s", err->message));
@@ -2149,6 +2216,8 @@ em_utils_in_addressbook (CamelInternetAddress *iaddr, gboolean local_only)
g_list_free(contacts);
}
+ stop = stop || camel_operation_cancel_check (NULL);
+
d(printf(" %s\n", stop?"found":"not found"));
g_object_unref(book);
@@ -2214,9 +2283,9 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local)
source = s->data;
book = e_book_new(source, &err);
- if (!e_book_open(book, TRUE, &err)
+ if (!try_open_e_book (book, TRUE, &err)
|| !e_book_get_contacts(book, query, &contacts, &err)) {
- stop = err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED;
+ stop = err && err->domain == E_BOOK_ERROR && err->code == E_BOOK_ERROR_CANCELLED;
g_object_unref(book);
d(g_warning("Can't get contacts: %s", err->message));
g_clear_error(&err);
@@ -2234,6 +2303,9 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local)
g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
g_list_free (contacts);
}
+
+ stop = stop || camel_operation_cancel_check (NULL);
+
g_object_unref (source); /* Is it? */
g_object_unref(book);
}
diff --git a/mail/mail-component.h b/mail/mail-component.h
index 95017b5149..3aa088c890 100644
--- a/mail/mail-component.h
+++ b/mail/mail-component.h
@@ -27,7 +27,7 @@
#include <bonobo/bonobo-object.h>
#include "shell/evolution-component.h"
-#include "Evolution-Mail.h"
+#include "mail/Evolution-Mail.h"
struct _CamelStore;
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 9894ec2fa5..87948fdf53 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -106,7 +106,7 @@ struct _send_info {
send_info_t type; /* 0 = fetch, 1 = send */
CamelOperation *cancel;
char *uri;
- int keep;
+ gboolean keep_on_server;
send_state_t state;
GtkWidget *progress_bar;
GtkWidget *cancel_button;
@@ -472,7 +472,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
d(printf("adding source %s\n", source->url));
info->uri = g_strdup (source->url);
- info->keep = source->keep_on_server;
+ info->keep_on_server = source->keep_on_server;
info->cancel = camel_operation_new (operation_status, info);
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
@@ -554,7 +554,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
d(printf("adding dest %s\n", destination));
info->uri = g_strdup (destination);
- info->keep = FALSE;
+ info->keep_on_server = FALSE;
info->cancel = camel_operation_new (operation_status, info);
info->state = SEND_ACTIVE;
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
@@ -938,7 +938,7 @@ mail_send_receive (void)
switch(info->type) {
case SEND_RECEIVE:
- mail_fetch_mail(info->uri, info->keep,
+ mail_fetch_mail(info->uri, info->keep_on_server,
FILTER_SOURCE_INCOMING,
info->cancel,
receive_get_folder, info,
@@ -979,11 +979,15 @@ auto_timeout(void *data)
{
struct _auto_data *info = data;
- if (camel_session_is_online(session)) {
- const char *uri = e_account_get_string(info->account, E_ACCOUNT_SOURCE_URL);
- int keep = e_account_get_bool(info->account, E_ACCOUNT_SOURCE_KEEP_ON_SERVER);
+ if (camel_session_is_online (session)) {
+ const gchar *uri;
+ gboolean keep_on_server;
- mail_receive_uri(uri, keep);
+ uri = e_account_get_string (
+ info->account, E_ACCOUNT_SOURCE_URL);
+ keep_on_server = e_account_get_bool (
+ info->account, E_ACCOUNT_SOURCE_KEEP_ON_SERVER);
+ mail_receive_uri (uri, keep_on_server);
}
return TRUE;
@@ -1098,7 +1102,7 @@ mail_autoreceive_init (CamelSession *session)
/* we setup the download info's in a hashtable, if we later need to build the gui, we insert
them in to add them. */
void
-mail_receive_uri (const char *uri, int keep)
+mail_receive_uri (const gchar *uri, gboolean keep_on_server)
{
struct _send_info *info;
struct _send_data *data;
@@ -1125,7 +1129,7 @@ mail_receive_uri (const char *uri, int keep)
info->progress_bar = NULL;
info->status_label = NULL;
info->uri = g_strdup (uri);
- info->keep = keep;
+ info->keep_on_server = keep_on_server;
info->cancel = camel_operation_new (operation_status, info);
info->cancel_button = NULL;
info->data = data;
@@ -1138,7 +1142,7 @@ mail_receive_uri (const char *uri, int keep)
switch (info->type) {
case SEND_RECEIVE:
- mail_fetch_mail (info->uri, info->keep,
+ mail_fetch_mail (info->uri, info->keep_on_server,
FILTER_SOURCE_INCOMING,
info->cancel,
receive_get_folder, info,
@@ -1198,7 +1202,7 @@ mail_send (void)
info->progress_bar = NULL;
info->status_label = NULL;
info->uri = g_strdup (transport->url);
- info->keep = FALSE;
+ info->keep_on_server = FALSE;
info->cancel = NULL;
info->cancel_button = NULL;
info->data = data;
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 8d8e4bbde2..4fc4e991ec 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -24,25 +24,22 @@
#define MAIL_SEND_RECV_H
#include <gtk/gtk.h>
-#include "mail-config.h"
+#include <camel/camel-session.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-struct _CamelSession;
+G_BEGIN_DECLS
/* send/receive all uri's */
-GtkWidget *mail_send_receive(void);
+GtkWidget * mail_send_receive (void);
+
/* receive a single uri */
-void mail_receive_uri(const char *uri, int keep);
-void mail_send (void);
+void mail_receive_uri (const gchar *uri,
+ gboolean keep_on_server);
+
+void mail_send (void);
+
/* setup auto receive stuff */
-void mail_autoreceive_init (struct _CamelSession *session);
+void mail_autoreceive_init (CamelSession *session);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* ! MAIL_SEND_RECV_H */
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 1de1ecfe61..3e7befb08d 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -171,13 +171,15 @@ get_password (CamelSession *session, CamelService *service, const char *domain,
char *ret = NULL;
EAccount *account = NULL;
- url = service ? camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL & (~CAMEL_URL_HIDE_AUTH)) : NULL;
+ url = service?camel_url_to_string(service->url, CAMEL_URL_HIDE_ALL):NULL;
if (!strcmp(item, "popb4smtp_uri")) {
/* not 100% mt safe, but should be ok */
if (url
&& (account = mail_config_get_account_by_transport_url(url)))
ret = g_strdup(account->source->url);
+ else
+ ret = g_strdup(url);
} else {
char *key = make_key(service, item);
EAccountService *config_service = NULL;
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 5df6d9e4cd..3dadf3d37f 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -103,6 +103,13 @@ vfolder_setup_exec (struct _setup_msg *m)
l = m->sources_uri;
while (l && !shutdown) {
d(printf(" Adding uri: %s\n", (char *)l->data));
+ if (strncmp((char *)l->data, "vfolder:/", 9) == 0 ||
+ strncmp((char *)l->data, "email://vfolder@local", 21) == 0) {
+ g_warning ("VFolder of VFolders not supporting. Ignoring loading this vfolder as a subfolder\n");
+ l=l->next;
+ continue;
+ }
+
folder = mail_tool_uri_to_folder (l->data, 0, &m->base.ex);
if (folder) {
list = g_list_append(list, folder);
@@ -712,6 +719,14 @@ rule_add_sources(GList *l, GList **sources_folderp, GList **sources_urip)
while (l) {
char *curi = em_uri_to_camel(l->data);
+ if (strncmp((char *)l->data, "vfolder:/", 9) == 0 ||
+ strncmp((char *)l->data, "email://vfolder@local", 21) == 0) {
+ g_warning ("VFolder of VFolders not supporting. Ignoring loading this vfolder as a subfolder\n");
+ l=l->next;
+ g_free(curi);
+ continue;
+ }
+
if (mail_note_get_folder_from_uri(curi, &newfolder)) {
if (newfolder)
sources_folder = g_list_append(sources_folder, newfolder);
diff --git a/mail/message-list.c b/mail/message-list.c
index 576bc1505d..5b3a1b646b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2273,6 +2273,8 @@ message_list_init (MessageList *message_list)
message_list->cursor_uid = NULL;
message_list->last_sel_single = FALSE;
+ message_list->regen_lock = g_mutex_new ();
+
/* TODO: Should this only get the selection if we're realised? */
p = message_list->priv = g_malloc0(sizeof(*message_list->priv));
p->invisible = gtk_invisible_new();
@@ -2374,6 +2376,7 @@ message_list_finalise (GObject *object)
g_free(message_list->cursor_uid);
g_mutex_free(message_list->hide_lock);
+ g_mutex_free (message_list->regen_lock);
g_free(message_list->folder_uri);
message_list->folder_uri = NULL;
@@ -4244,7 +4247,9 @@ regen_list_done (struct _regen_list_msg *m)
m->ml->search = m->search;
m->search = NULL;
+ g_mutex_lock (m->ml->regen_lock);
m->ml->regen = g_list_remove(m->ml->regen, m);
+ g_mutex_unlock (m->ml->regen_lock);
if (m->ml->regen == NULL && m->ml->pending_select_uid) {
char *uid = m->ml->pending_select_uid;
@@ -4307,7 +4312,9 @@ regen_list_free (struct _regen_list_msg *m)
camel_folder_change_info_free (m->changes);
/* we have to poke this here as well since we might've been cancelled and regened wont get called */
+ g_mutex_lock (m->ml->regen_lock);
m->ml->regen = g_list_remove(m->ml->regen, m);
+ g_mutex_unlock (m->ml->regen_lock);
if (m->expand_state)
xmlFreeDoc (m->expand_state);
@@ -4328,7 +4335,9 @@ ml_regen_timeout(struct _regen_list_msg *m)
{
e_profile_event_emit("list.regenerate", m->folder->full_name, 0);
+ g_mutex_lock (m->ml->regen_lock);
m->ml->regen = g_list_prepend(m->ml->regen, m);
+ g_mutex_unlock (m->ml->regen_lock);
/* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */
mail_msg_fast_ordered_push (m);
@@ -4343,8 +4352,11 @@ mail_regen_cancel(MessageList *ml)
{
/* cancel any outstanding regeneration requests, not we don't clear, they clear themselves */
if (ml->regen) {
- GList *l = ml->regen;
+ GList *l;
+
+ g_mutex_lock (ml->regen_lock);
+ l = ml->regen;
while (l) {
MailMsg *mm = l->data;
@@ -4352,6 +4364,8 @@ mail_regen_cancel(MessageList *ml)
camel_operation_cancel(mm->cancel);
l = l->next;
}
+
+ g_mutex_unlock (ml->regen_lock);
}
/* including unqueued ones */
diff --git a/mail/message-list.h b/mail/message-list.h
index cc58e1e798..47be897fd2 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -151,6 +151,7 @@ struct _MessageList {
/* list of outstanding regeneration requests */
GList *regen;
+ GMutex *regen_lock; /* when writing to the regen, guard with this lock too */
char *pending_select_uid; /* set if we were busy regnerating while we had a select come in */
guint regen_timeout_id;
void *regen_timeout_msg;