aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-01-29 17:33:15 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-01-29 17:33:15 +0800
commitaad4202594a706636bc893b8716a573861216175 (patch)
treef0e1c0efaf1b86a1408805353f3e914216aa469a /mail/message-list.c
parent1b18f022ca57ebebb272a148b25173d92b2b89c5 (diff)
downloadgsoc2013-evolution-aad4202594a706636bc893b8716a573861216175.tar.gz
gsoc2013-evolution-aad4202594a706636bc893b8716a573861216175.tar.zst
gsoc2013-evolution-aad4202594a706636bc893b8716a573861216175.zip
Debug function to compare the tree we think we have, after an incremental
2001-01-29 Not Zed <NotZed@Ximian.com> * message-list.c (tree_equal): Debug function to compare the tree we think we have, after an incremental update. (build_tree): Check the tree after we've built it. * mail-mt.c (mail_get_password): If we are being called from the main gui thread, then just call the dialogue directly. Ideally we dont want this anyway but lets handle the case nicely. (mail_get_password): Try locking around the password request, to single-queue any password requests. (mail_msg_init): Push an exit handler to clean it up on completion. * mail-send-recv.c (receive_update_got_store): New function called when the store has been retrieved asynchronously. (mail_send_receive): Get the store asynchronously. This was causing problems where the password dialogue would try and be called from the main thread via a message. * mail-ops.c (mail_get_store): New function to get a store (a)synchronously. More or less taken from subscribe-dialog, which i will remove later. (mail_scan_subfolders): Try running the scan subfolder thing asynchronously, to help startup time. Not sure if this will work, but presumably the shell can handle the folders appearing later ok. svn path=/trunk/; revision=7886
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 44d82c63f7..69ca413314 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1460,6 +1460,8 @@ static void build_subtree (MessageList *ml, ETreePath *parent, CamelFolderThread
static void build_subtree_diff (MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, GHashTable *expanded_nodes);
+static int tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp);
+
static void
build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *changes)
{
@@ -1489,7 +1491,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
e_tree_model_node_set_expanded(etm, ml->tree_root, TRUE);
}
-#define BROKEN_ETREE /* avoid some broken code in etree(?) by not using the incremental update */
+/*#define BROKEN_ETREE*/ /* avoid some broken code in etree(?) by not using the incremental update */
top = e_tree_model_node_get_first_child(etm, ml->tree_root);
#ifndef BROKEN_ETREE
@@ -1502,6 +1504,8 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
#ifndef BROKEN_ETREE
} else {
build_subtree_diff(ml, ml->tree_root, top, thread->tree, &row, expanded_nodes);
+ top = e_tree_model_node_get_first_child(etm, ml->tree_root);
+ tree_equal(ml->table_model, top, thread->tree);
}
#endif
free_tree_state(expanded_nodes);
@@ -1601,6 +1605,57 @@ node_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp)
return 0;
}
+/* debug function - compare the two trees to see if they are the same */
+static int
+tree_equal(ETreeModel *etm, ETreePath *ap, CamelFolderThreadNode *bp)
+{
+ char *uid;
+
+ while (ap && bp) {
+ if (!node_equal(etm, ap, bp)) {
+ g_warning("Nodes in tree differ");
+ uid = e_tree_model_node_get_data(etm, ap);
+ if (id_is_uid(uid))
+ printf("table uid = %s\n", id_uid(uid));
+ else
+ printf("table subject = %s\n", id_subject(uid));
+ if (bp->message)
+ printf("camel uid = %s\n", camel_message_info_uid(bp->message));
+ else
+ printf("camel subject = %s\n", bp->root_subject);
+ return FALSE;
+ } else {
+ if (!tree_equal(etm, e_tree_model_node_get_first_child(etm, ap), bp->child))
+ return FALSE;
+ }
+ bp = bp->next;
+ ap = e_tree_model_node_get_next(etm, ap);
+ }
+
+ if (ap || bp) {
+ g_warning("Tree differs, out of nodes in one branch");
+ if (ap) {
+ uid = e_tree_model_node_get_data(etm, ap);
+ if (uid) {
+ if (id_is_uid(uid))
+ printf("table uid = %s\n", id_uid(uid));
+ else
+ printf("table subject = %s\n", id_subject(uid));
+ } else
+ printf("uid is empty?\n");
+ }
+ if (bp) {
+ if (bp->message)
+ printf("camel uid = %s\n", camel_message_info_uid(bp->message));
+ else
+ printf("camel subject = %s\n", bp->root_subject);
+ return FALSE;
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
/* adds a single node, retains save state, and handles adding children if required */
static void
add_node_diff(MessageList *ml, ETreePath *parent, ETreePath *path, CamelFolderThreadNode *c, int *row, int myrow, GHashTable *expanded_nodes)