diff options
author | Not Zed <NotZed@Ximian.com> | 2005-07-21 12:15:21 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-07-21 12:15:21 +0800 |
commit | 1b8003c1768fa6a0d33a91f0637fc99fe0801ae8 (patch) | |
tree | 68e39aba1aa97e5537332c83eace7ce682e5defa | |
parent | a86713990d993da394f11a4c22a34d1d7876267a (diff) | |
download | gsoc2013-evolution-1b8003c1768fa6a0d33a91f0637fc99fe0801ae8.tar.gz gsoc2013-evolution-1b8003c1768fa6a0d33a91f0637fc99fe0801ae8.tar.zst gsoc2013-evolution-1b8003c1768fa6a0d33a91f0637fc99fe0801ae8.zip |
if we get a null default, then set "" on the entry. (emae_option_entry):
2005-07-21 Not Zed <NotZed@Ximian.com>
* em-account-editor.c (emae_option_entry): if we get a null
default, then set "" on the entry.
(emae_option_entry): set the default value on the url if it
doesn't exist already.
2005-07-20 Not Zed <NotZed@Ximian.com>
* mail-send-recv.c (refresh_folders_desc, refresh_folders_get)
(refresh_folders_got, refresh_folders_free, get_folders)
(receive_update_got_folderinfo, receive_update_got_store): refresh
all the folders manually and directly.
* mail-folder-cache.c (setup_folder): propagate even -1 unread
counts, they get ignored later.
* em-composer-utils.c (emu_handle_receipt_message)
(em_utils_handle_receipt): use getmessagex too, so we can always
clear any error.
* em-folder-view.c (emfv_message_selected_timeout)
(emfv_list_done_message_selected): use getmessagex and do
something meaninful with the error.
* mail-ops.c (mail_get_messagex): added new get message which
returns an exception.
2005-07-19 Not Zed <NotZed@Ximian.com>
* mail-tools.c (mail_tool_uri_to_folder): dont get the service
connected, it will connect if it needs to.
* mail-ops.c (get_folderinfo_get): * em-folder-utils.c
(emft_copy_folders__copy)
(emfu_delete_folders): * em-folder-tree.c
(emft_get_folder_info__get): Always request subscribed folders, if
the backend doesn't implement it it will ignore it.
2005-07-13 Not Zed <NotZed@Ximian.com>
* mail-send-recv.c (mail_autoreceive_init, auto_online): listen to
session online events, and if we are online, trigger an
auto-receive of all auto-check accounts.
2005-07-11 Not Zed <NotZed@Ximian.com>
* mail-send-recv.c (auto_account_commit): force an update
immediately if we're setting up the timeout to start with.
* em-folder-tree-model.c (em_folder_tree_model_set_unread_count):
noop if the unread count < 0.
(em_folder_tree_model_set_folder_info): only set the unread count
if we actually have one.
* em-folder-tree.c (emft_tree_row_expanded): get the folder list
'fast'.
* mail-ops.c (get_folderinfo_get): get the folder list 'fast'.
svn path=/trunk/; revision=29822
-rw-r--r-- | mail/ChangeLog | 60 | ||||
-rw-r--r-- | mail/em-account-editor.c | 10 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 7 | ||||
-rw-r--r-- | mail/em-folder-tree-model.c | 8 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 7 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 10 | ||||
-rw-r--r-- | mail/em-folder-view.c | 16 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 4 | ||||
-rw-r--r-- | mail/mail-ops.c | 43 | ||||
-rw-r--r-- | mail/mail-ops.h | 5 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 113 | ||||
-rw-r--r-- | mail/mail-tools.c | 2 |
12 files changed, 253 insertions, 32 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index f3d832a9db..b5ef851b80 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,63 @@ +2005-07-21 Not Zed <NotZed@Ximian.com> + + * em-account-editor.c (emae_option_entry): if we get a null + default, then set "" on the entry. + (emae_option_entry): set the default value on the url if it + doesn't exist already. + +2005-07-20 Not Zed <NotZed@Ximian.com> + + * mail-send-recv.c (refresh_folders_desc, refresh_folders_get) + (refresh_folders_got, refresh_folders_free, get_folders) + (receive_update_got_folderinfo, receive_update_got_store): refresh + all the folders manually and directly. + + * mail-folder-cache.c (setup_folder): propagate even -1 unread + counts, they get ignored later. + + * em-composer-utils.c (emu_handle_receipt_message) + (em_utils_handle_receipt): use getmessagex too, so we can always + clear any error. + + * em-folder-view.c (emfv_message_selected_timeout) + (emfv_list_done_message_selected): use getmessagex and do + something meaninful with the error. + + * mail-ops.c (mail_get_messagex): added new get message which + returns an exception. + +2005-07-19 Not Zed <NotZed@Ximian.com> + + * mail-tools.c (mail_tool_uri_to_folder): dont get the service + connected, it will connect if it needs to. + + * mail-ops.c (get_folderinfo_get): * em-folder-utils.c + (emft_copy_folders__copy) + (emfu_delete_folders): * em-folder-tree.c + (emft_get_folder_info__get): Always request subscribed folders, if + the backend doesn't implement it it will ignore it. + +2005-07-13 Not Zed <NotZed@Ximian.com> + + * mail-send-recv.c (mail_autoreceive_init, auto_online): listen to + session online events, and if we are online, trigger an + auto-receive of all auto-check accounts. + +2005-07-11 Not Zed <NotZed@Ximian.com> + + * mail-send-recv.c (auto_account_commit): force an update + immediately if we're setting up the timeout to start with. + + * em-folder-tree-model.c (em_folder_tree_model_set_unread_count): + noop if the unread count < 0. + (em_folder_tree_model_set_folder_info): only set the unread count + if we actually have one. + + * em-folder-tree.c (emft_tree_row_expanded): get the folder list + 'fast'. + + * mail-ops.c (get_folderinfo_get): get the folder list 'fast'. + 2005-07-19 Srinivasa Ragavan <sragavan@novell.com> * em-folder-tree.c: (emft_popup_move) calling the wrong api to diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index f9b417109f..87c01f5186 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -1814,8 +1814,14 @@ emae_option_entry(EMAccountEditorService *service, CamelURL *url, const char *na GtkWidget *w; const char *val = camel_url_get_param(url, name); - if (val == NULL) - val = def; + if (val == NULL) { + if (def) { + val = def; + camel_url_set_param(url, name, val); + emae_uri_changed(service, url); + } else + val = ""; + } w = g_object_new(gtk_entry_get_type(), "text", val, diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index eb843b2862..f994a79a83 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1071,10 +1071,13 @@ em_utils_redirect_message_by_uid (CamelFolder *folder, const char *uid) } static void -emu_handle_receipt_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) +emu_handle_receipt_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *ex) { if (msg) em_utils_handle_receipt(folder, uid, msg); + + /* we dont care really if we can't get the message */ + camel_exception_clear(ex); } /* Message disposition notifications, rfc 2298 */ @@ -1095,7 +1098,7 @@ em_utils_handle_receipt (CamelFolder *folder, const char *uid, CamelMimeMessage } if (msg == NULL) { - mail_get_message(folder, uid, emu_handle_receipt_message, NULL, mail_thread_new); + mail_get_messagex(folder, uid, emu_handle_receipt_message, NULL, mail_thread_new); camel_message_info_free(info); return; } diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 266928eb5c..1a622cc9eb 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -443,7 +443,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite /* HACK: if we have the folder, and its the outbox folder, we need the total count, not unread */ /* This is duplicated in mail-folder-cache too, should perhaps be functionised */ - unread = fi->unread == -1 ? 0 : fi->unread; + unread = fi->unread; if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) { if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)) { int total; @@ -482,11 +482,13 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite COL_POINTER_CAMEL_STORE, si->store, COL_STRING_FULL_NAME, fi->full_name, COL_STRING_URI, fi->uri, - COL_UINT_UNREAD, unread, COL_UINT_FLAGS, flags, COL_BOOL_IS_STORE, FALSE, COL_BOOL_LOAD_SUBDIRS, load, -1); + + if (unread != ~0) + gtk_tree_store_set ((GtkTreeStore *) model, iter, COL_UINT_UNREAD, unread, -1); if (load) { /* create a placeholder node for our subfolders... */ @@ -1103,7 +1105,7 @@ em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *sto u(printf("set unread count %p '%s' %d\n", store, full, unread)); if (unread < 0) - unread = 0; + return; if (!(si = g_hash_table_lookup (model->store_hash, store))) { u(printf(" can't find store\n")); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 969ba2e871..3ee0361e6b 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1757,10 +1757,7 @@ static void emft_get_folder_info__get (struct _mail_msg *mm) { struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; - guint32 flags = m->flags; - - if (camel_store_supports_subscriptions (m->store)) - flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; + guint32 flags = m->flags | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; m->fi = camel_store_get_folder_info (m->store, m->top, flags, &mm->ex); } @@ -1937,7 +1934,7 @@ emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *t m->emft = emft; g_object_ref(emft); m->top = full_name; - m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE; + m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST; e_thread_put (mail_thread_new, (EMsg *) m); } diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 844f4b8bb5..ee3bcd006e 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -108,16 +108,13 @@ static void emft_copy_folders__copy (struct _mail_msg *mm) { struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; - guint32 flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE; + guint32 flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; GList *pending = NULL, *deleting = NULL, *l; GString *fromname, *toname; CamelFolderInfo *fi; const char *tmp; int fromlen; - if (camel_store_supports_subscriptions (m->fromstore)) - flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; - if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &mm->ex))) return; @@ -431,12 +428,9 @@ emfu_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex) static void emfu_delete_folders (CamelStore *store, const char *full_name, CamelException *ex) { - guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST; + guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; CamelFolderInfo *fi; - if (camel_store_supports_subscriptions (store)) - flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; - fi = camel_store_get_folder_info (store, full_name, flags, ex); if (camel_exception_is_set (ex)) return; diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 0526cc413b..8eb51b198f 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -87,6 +87,7 @@ #include "em-event.h" #include <gtkhtml/gtkhtml.h> +#include <gtkhtml/gtkhtml-stream.h> #include "mail-mt.h" #include "mail-ops.h" @@ -2166,7 +2167,7 @@ do_mark_seen (gpointer user_data) } static void -emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) +emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *ex) { EMFolderView *emfv = data; EMEvent *eme; @@ -2211,6 +2212,17 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM } else { emfv_set_seen (emfv, uid); } + } else if (camel_exception_is_set(ex)) { + GtkHTMLStream *hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); + + /* Display the error inline rather than popping up an annoying box. + We also clear the exception, this stops the box popping up */ + + gtk_html_stream_printf(hstream, "<h2>%s</h2><p>%s</p>", + _("Unable to retrieve message"), + ex->desc); + gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); + camel_exception_clear(ex); } emfv->priv->nomarkseen = FALSE; @@ -2231,7 +2243,7 @@ emfv_message_selected_timeout(void *data) g_object_ref (emfv); /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */ e_profile_event_emit("goto.load", emfv->displayed_uid, 0); - mail_get_message(emfv->folder, emfv->displayed_uid, emfv_list_done_message_selected, emfv, mail_thread_queued); + mail_get_messagex(emfv->folder, emfv->displayed_uid, emfv_list_done_message_selected, emfv, mail_thread_queued); } else { e_profile_event_emit("goto.empty", "", 0); g_free(emfv->priv->selected_uid); diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 689b7c5c76..c7e9bcff06 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -390,7 +390,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) if (mfi) { update_1folder(mfi, 0, fi); } else { - /*d(printf("Adding new folder: %s (%s) %d unread\n", fi->path, fi->url, fi->unread_message_count));*/ + d(printf("Adding new folder: %s (%s) %d unread\n", fi->path, fi->url, fi->unread_message_count)); mfi = g_malloc0(sizeof(*mfi)); mfi->full_name = g_strdup(fi->full_name); mfi->uri = g_strdup(fi->uri); @@ -403,7 +403,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up = g_malloc0(sizeof(*up)); up->full_name = g_strdup(mfi->full_name); up->uri = g_strdup(fi->uri); - up->unread = (fi->unread==-1)?0:fi->unread; + up->unread = fi->unread; up->store = si->store; camel_object_ref(up->store); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index e7770fc017..846c251c41 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1061,10 +1061,7 @@ static void get_folderinfo_get (struct _mail_msg *mm) { struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE; - - if (camel_store_supports_subscriptions (m->store)) - flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; + guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; m->info = camel_store_get_folder_info (m->store, NULL, flags, &mm->ex); } @@ -1796,6 +1793,44 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder e_thread_put(thread, (EMsg *)m); } +typedef void (*get_done)(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *); + +static void get_messagex_got(struct _mail_msg *mm) +{ + struct _get_message_msg *m = (struct _get_message_msg *)mm; + + if (m->done) { + get_done done = (get_done)m->done; + done(m->folder, m->uid, m->message, m->data, &mm->ex); + } +} + +static struct _mail_msg_op get_messagex_op = { + get_message_desc, + get_message_get, + get_messagex_got, + get_message_free, +}; + +/* This is temporary, to avoid having to rewrite everything that uses + mail_get_message; it adds an exception argument to the callback */ +void +mail_get_messagex(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *), + void *data, EThread *thread) +{ + struct _get_message_msg *m; + + m = mail_msg_new(&get_messagex_op, NULL, sizeof(*m)); + m->folder = folder; + camel_object_ref(folder); + m->uid = g_strdup(uid); + m->data = data; + m->done = done; + m->cancel = camel_operation_new(NULL, NULL); + + e_thread_put(thread, (EMsg *)m); +} + /* ********************************************************************** */ struct _get_messages_msg { diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 21c0685165..7ae91131b3 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -57,6 +57,11 @@ void mail_get_message (CamelFolder *folder, const char *uid, void *data, EThread *thread); +void +mail_get_messagex(CamelFolder *folder, const char *uid, + void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data, CamelException *), + void *data, EThread *thread); + /* get several messages */ void mail_get_messages (CamelFolder *folder, GPtrArray *uids, void (*done) (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *data), diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 71d8337357..708826226d 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -683,10 +683,97 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep return folder; } +/* ********************************************************************** */ + +struct _refresh_folders_msg { + struct _mail_msg msg; + + struct _send_info *info; + GPtrArray *folders; + CamelStore *store; +}; + +static char * +refresh_folders_desc (struct _mail_msg *mm, int done) +{ + return g_strdup_printf(_("Checking for new mail")); +} + +static void +refresh_folders_get (struct _mail_msg *mm) +{ + struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; + int i; + CamelFolder *folder; + + for (i=0;i<m->folders->len;i++) { + folder = mail_tool_uri_to_folder(m->folders->pdata[i], 0, NULL); + if (folder) { + camel_folder_refresh_info(folder, NULL); + camel_object_unref(folder); + } + if (camel_operation_cancel_check(m->info->cancel)) + break; + } +} + +static void +refresh_folders_got (struct _mail_msg *mm) +{ + struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; + + receive_done("", m->info); +} + +static void +refresh_folders_free (struct _mail_msg *mm) +{ + struct _refresh_folders_msg *m = (struct _refresh_folders_msg *)mm; + int i; + + for (i=0;i<m->folders->len;i++) + g_free(m->folders->pdata[i]); + g_ptr_array_free(m->folders, TRUE); + camel_object_unref(m->store); +} + +static struct _mail_msg_op refresh_folders_op = { + refresh_folders_desc, + refresh_folders_get, + refresh_folders_got, + refresh_folders_free, +}; + +static void +get_folders(GPtrArray *folders, CamelFolderInfo *info) +{ + while (info) { + g_ptr_array_add(folders, g_strdup(info->uri)); + get_folders(folders, info->child); + info = info->next; + } +} + static void -receive_update_got_folderinfo (CamelStore *store, CamelFolderInfo *info, void *data) +receive_update_got_folderinfo(CamelStore *store, CamelFolderInfo *info, void *data) { - receive_done ("", data); + if (info) { + GPtrArray *folders = g_ptr_array_new(); + struct _refresh_folders_msg *m; + struct _send_info *sinfo = data; + + get_folders(folders, info); + + m = mail_msg_new(&refresh_folders_op, NULL, sizeof(*m)); + m->store = store; + camel_object_ref(store); + m->folders = folders; + m->info = sinfo; + + e_thread_put(mail_thread_new, (EMsg *)m); + } else { + receive_done ("", data); + } } static void @@ -697,7 +784,7 @@ receive_update_got_store (char *uri, CamelStore *store, void *data) if (store) { mail_note_store(store, info->cancel, receive_update_got_folderinfo, info); } else { - receive_done ("", info); + receive_done("", info); } } @@ -849,6 +936,24 @@ auto_account_changed(EAccountList *eal, EAccount *ea, void *dummy) auto_account_commit(info); } +static void +auto_online(CamelObject *o, void *ed, void *d) +{ + EIterator *iter; + EAccountList *accounts; + struct _auto_data *info; + + if (!GPOINTER_TO_INT(ed)) + return; + + accounts = mail_config_get_accounts (); + for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) { + info = g_object_get_data((GObject *)e_iterator_get(iter), "mail-autoreceive"); + if (info && info->timeout_id) + auto_timeout(info); + } +} + /* call to setup initial, and after changes are made to the config */ /* FIXME: Need a cleanup funciton for when object is deactivated */ void @@ -869,6 +974,8 @@ mail_autoreceive_init(void) for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL); + + camel_object_hook_event(mail_component_peek_session(NULL), "online", auto_online, NULL); } /* we setup the download info's in a hashtable, if we later need to build the gui, we insert diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 1b0aad9841..761c425be7 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -293,7 +293,7 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) return NULL; } - store = camel_session_get_store (session, uri + offset, ex); + store = camel_session_get_service(session, uri+offset, CAMEL_PROVIDER_STORE, ex); if (store) { const char *name; |