sync with sylpheed 0.6.3cvs7
authorPaul Mangan <paul@claws-mail.org>
Wed, 17 Oct 2001 09:25:12 +0000 (09:25 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 17 Oct 2001 09:25:12 +0000 (09:25 +0000)
12 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/folderview.c
src/inc.c
src/mainwindow.c
src/procmsg.c
src/procmsg.h
src/summaryview.c
src/summaryview.h

index 344cecf..e0b76ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2001-10-17
+
+       * src/compose.c: changed "Send" shortcut to Ctrl+Enter.
+
+2001-10-16
+
+       * src/inc.c: fixed a bug that crashed sylpheed if Cancel button
+         was clicked twice.
+
+2001-10-16
+
+       * src/procmsg.c: procmsg_get_thread_tree(): complete the unfinished
+         threads.
+       * src/summaryview.c:
+         summary_thread_init(): separated from summary_thread_build(). 
+         summary_thread_build(): removed the codes for initialization.
+         summary_set_ctree_from_list(): call summary_thread_init() instead
+         of summary_thread_build().
+         summary_filter(): fixed a bug that didn't moved messages despite
+         of immediate execution setting.
+
+2001-10-14
+
+       * src/procmsg.c: procmsg_get_thread_tree(): new. It generates the
+         reversed thread tree from message list.
+       * src/summaryview.c: summary_set_ctree_from_list(): prepend the
+         node to the head instead of appending to the tail. This prevents
+         the traverse of node list inside of the GtkCTree, and considerably
+         speeds up the summary display (the order is O(n^2) -> O(n)).
+
 2001-10-12
 
        * src/prefs_common.c
index d07add6..0762203 100644 (file)
@@ -1,3 +1,9 @@
+2001-10-17 [paul]      0.6.3claws20
+
+       * sync with sylpheed 0.6.3cvs7
+               see ChangeLog entries 2001-10-14, 2001-10-16, and
+               2001-10-17
+
 2001-10-17 [darko]
 
        * src/compose.c
index c2cd99e..bf70800 100644 (file)
@@ -1,3 +1,33 @@
+2001-10-17
+
+       * src/compose.c: ¡ÖÁ÷¿®¡×¥·¥ç¡¼¥È¥«¥Ã¥È¤ò Ctrl+Enter ¤ËÊѹ¹¡£
+
+2001-10-16
+
+       * src/inc.c: ¥­¥ã¥ó¥»¥ë¥Ü¥¿¥ó¤¬2²ó²¡¤µ¤ì¤¿¤é sylpheed ¤¬¥¯¥é¥Ã¥·¥å
+         ¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+
+2001-10-16
+
+       * src/procmsg.c: procmsg_get_thread_tree(): Ì¤´°À®¤Î¥¹¥ì¥Ã¥É¤ò´°À®
+         ¤µ¤»¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/summaryview.c:
+         summary_thread_init(): summary_thread_build() ¤«¤éʬΥ¡£
+         summary_thread_build(): ½é´ü²½¤Î¤¿¤á¤Î¥³¡¼¥É¤òºï½ü¡£
+         summary_set_ctree_from_list(): summary_thread_build() ¤ÎÂå¤ï¤ê¤Ë
+         summary_thread_init() ¤ò¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+         summary_filter(): Â¨»þ¼Â¹Ô¤ÎÀßÄê¤Ë¤â´Ø¤ï¤é¤º¥á¥Ã¥»¡¼¥¸¤ò°ÜÆ°¤·¤Ê¤¤
+         ¥Ð¥°¤ò½¤Àµ¡£
+
+2001-10-14
+
+       * src/procmsg.c: procmsg_get_thread_tree(): ¿·µ¬¡£¥á¥Ã¥»¡¼¥¸¥ê¥¹¥È
+         ¤«¤éȿž¤·¤¿¥¹¥ì¥Ã¥É¥Ä¥ê¡¼¤òÀ¸À®¤¹¤ë¡£
+       * src/summaryview.c: summary_set_ctree_from_list(): ¥Î¡¼¥É¤òËöÈø
+         ¤ËÄɲ乤ëÂå¤ï¤ê¤ËÀèƬ¤ËÄɲ乤ë¤è¤¦¤Ë¤·¤¿¡£¤³¤ì¤Ë¤è¤ê GtkCTree
+         ÆâÉô¤Ç¤Î¥Î¡¼¥É¥ê¥¹¥È¤Î¥È¥é¥Ð¡¼¥¹¤òÈò¤±¤ë¤³¤È¤¬¤Ç¤­¡¢¥µ¥Þ¥êɽ¼¨
+         ¤ò¤«¤Ê¤ê¹â®²½¤Ç¤­¤ë(O(n^2) -> O(n) ¤Î¥ª¡¼¥À¡¼)¡£
+
 2001-10-12
 
        * src/prefs_common.c
index c7dd7f1..f1bbb2d 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws19
+EXTRA_VERSION=claws20
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index fe12cde..0ba52c5 100644 (file)
@@ -442,7 +442,7 @@ static GtkItemFactoryEntry compose_entries[] =
                        "<alt>X", compose_ext_editor_cb, 0, NULL},
 
        {N_("/_Message"),               NULL, NULL, 0, "<Branch>"},
-       {N_("/_Message/_Send"),         "<shift><control>S",
+       {N_("/_Message/_Send"),         "<control>Return",
                                        compose_send_cb, 0, NULL},
        {N_("/_Message/Send _later"),   "<shift><alt>S",
                                        compose_send_later_cb,  0, NULL},
index f218b00..647ccbf 100644 (file)
@@ -252,8 +252,8 @@ static GtkItemFactoryEntry folderview_imap_popup_entries[] =
        {N_("/_Rename folder..."),      NULL, NULL, 0, NULL},
        {N_("/_Delete folder"),         NULL, folderview_rm_imap_folder_cb, 0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
-       {N_("/Re_scan folder tree"),    NULL, folderview_update_tree_cb, 0, NULL},
-       {N_("/_Update folder tree"),    NULL, folderview_update_tree_cb, 1, NULL},
+       {N_("/_Update folder tree"),    NULL, folderview_update_tree_cb, 0, NULL},
+       {N_("/Re_scan folder tree"),    NULL, folderview_update_tree_cb, 1, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/Remove _IMAP4 account"),  NULL, folderview_rm_imap_server_cb, 0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
index c35c73b..2acd948 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -681,6 +681,8 @@ static IncState inc_pop3_session_do(IncSession *session)
 
 static gint pop3_automaton_terminate(SockInfo *source, Automaton *atm)
 {
+       if (atm->terminated) return 0;
+
        if (atm->tag > 0) {
                gdk_input_remove(atm->tag);
                atm->tag = 0;
@@ -782,6 +784,7 @@ static gint connection_check_cb(Automaton *atm)
                        manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
                }
                pop3_automaton_terminate(sockinfo, atm);
+               state->sockinfo = NULL;
                return FALSE;
        } else if (sockinfo->state == CONN_ESTABLISHED) {
                atm->timeout_tag = 0;
@@ -972,6 +975,8 @@ static void inc_cancel(GtkWidget *widget, gpointer data)
        IncSession *session = dialog->queue_list->data;
        SockInfo *sockinfo = session->pop3_state->sockinfo;
 
+       if (!sockinfo || session->atm->terminated == TRUE) return;
+
 #if USE_THREADS
        if (sockinfo->state == CONN_READY ||
            sockinfo->state == CONN_LOOKUPSUCCESS) {
@@ -983,6 +988,7 @@ static void inc_cancel(GtkWidget *widget, gpointer data)
 
        session->pop3_state->inc_state = INC_CANCEL;
        pop3_automaton_terminate(sockinfo, session->atm);
+       session->pop3_state->sockinfo = NULL;
 }
 
 static gint inc_spool(void)
index 94d4e5d..9e6dc7c 100644 (file)
@@ -2555,7 +2555,7 @@ static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
        ifactory = gtk_item_factory_from_widget(widget);
 
        if (0 == action) {
-               summary_thread_build(mainwin->summaryview, FALSE);
+               summary_thread_build(mainwin->summaryview);
                mainwin->summaryview->folder_item->threaded = TRUE;
                menu_set_sensitive(ifactory, "/Summary/Thread view",   FALSE);
                menu_set_sensitive(ifactory, "/Summary/Unthread view", TRUE);
index c529fcb..31ea663 100644 (file)
@@ -496,6 +496,54 @@ FILE *procmsg_open_mark_file(const gchar *folder, gboolean append)
        return fp;
 }
 
+/* return the reversed thread tree */
+GNode *procmsg_get_thread_tree(GSList *mlist)
+{
+       GNode *root, *parent, *node, *next;
+       GHashTable *table;
+       MsgInfo *msginfo;
+       const gchar *msgid;
+
+       root = g_node_new(NULL);
+       table = g_hash_table_new(g_str_hash, g_str_equal);
+
+       for (; mlist != NULL; mlist = mlist->next) {
+               msginfo = (MsgInfo *)mlist->data;
+               parent = root;
+
+               if (msginfo->inreplyto) {
+                       parent = g_hash_table_lookup(table, msginfo->inreplyto);
+                       if (parent == NULL)
+                               parent = root;
+               }
+               node = g_node_insert_data_before
+                       (parent, parent == root ? parent->children : NULL,
+                        msginfo);
+               if ((msgid = msginfo->msgid) &&
+                   g_hash_table_lookup(table, msgid) == NULL)
+                       g_hash_table_insert(table, (gchar *)msgid, node);
+       }
+
+       /* complete the unfinished threads */
+       for (node = root->children; node != NULL; ) {
+               next = node->next;
+               msginfo = (MsgInfo *)node->data;
+               if (msginfo->inreplyto) {
+                       parent = g_hash_table_lookup(table, msginfo->inreplyto);
+                       if (parent && parent != node) {
+                               g_node_unlink(node);
+                               g_node_insert_before
+                                       (parent, parent->children, node);
+                       }
+               }
+               node = next;
+       }
+
+       g_hash_table_destroy(table);
+
+       return root;
+}
+
 void procmsg_move_messages(GSList *mlist)
 {
        GSList *cur, *movelist = NULL;
index 8097cfa..8c729b0 100644 (file)
@@ -217,6 +217,8 @@ void        procmsg_get_mark_sum            (const gchar    *folder,
 FILE   *procmsg_open_mark_file         (const gchar    *folder,
                                         gboolean        append);
 
+GNode  *procmsg_get_thread_tree                (GSList         *mlist);
+
 void   procmsg_move_messages           (GSList         *mlist);
 void   procmsg_copy_messages           (GSList         *mlist);
 
index 4459a11..00e1867 100644 (file)
@@ -232,6 +232,8 @@ static void summary_execute_delete  (SummaryView            *summaryview);
 static void summary_execute_delete_func        (GtkCTree               *ctree,
                                         GtkCTreeNode           *node,
                                         gpointer                data);
+
+static void summary_thread_init                (SummaryView            *summaryview);
 static void summary_ignore_thread(SummaryView *summaryview);
 static void summary_unignore_thread(SummaryView *summaryview);
 
@@ -1913,6 +1915,44 @@ void summary_sort(SummaryView *summaryview, SummarySortType type)
        main_window_cursor_normal(summaryview->mainwin);
 }
 
+gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
+                                  GtkCTreeNode *cnode, gpointer data)
+{
+       SummaryView *summaryview = (SummaryView *)data;
+       MsgInfo *msginfo = (MsgInfo *)gnode->data;
+       gchar *text[N_SUMMARY_COLS];
+       gint *col_pos = summaryview->col_pos;
+       const gchar *msgid = msginfo->msgid;
+       GHashTable *msgid_table = summaryview->msgid_table;
+
+       summary_set_header(summaryview, text, msginfo);
+
+       gtk_ctree_set_node_info(ctree, cnode, text[col_pos[S_COL_SUBJECT]], 2,
+                               NULL, NULL, NULL, NULL, FALSE,
+                               gnode->parent->parent ? TRUE : FALSE);
+#define SET_TEXT(col) \
+       gtk_ctree_node_set_text(ctree, cnode, col_pos[col], \
+                               text[col_pos[col]])
+
+       SET_TEXT(S_COL_NUMBER);
+       SET_TEXT(S_COL_SCORE);
+       SET_TEXT(S_COL_SIZE);
+       SET_TEXT(S_COL_DATE);
+       SET_TEXT(S_COL_FROM);
+       SET_TEXT(S_COL_SUBJECT);
+
+#undef SET_TEXT
+
+       GTKUT_CTREE_NODE_SET_ROW_DATA(cnode, msginfo);
+       summary_set_marks_func(ctree, cnode, summaryview);
+
+       if (msgid)
+       //if (msgid && g_hash_table_lookup(msgid_table, msgid) == NULL)
+               g_hash_table_insert(msgid_table, (gchar *)msgid, cnode);
+
+       return TRUE;
+}
+
 static GtkCTreeNode * subject_table_lookup(GHashTable *subject_table,
                                           gchar * subject)
 {
@@ -1938,8 +1978,7 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
        MsgInfo *msginfo;
        MsgInfo *parentinfo;
        MsgInfo *cur_msginfo;
-       GtkCTreeNode *node, *parent;
-       gchar *text[N_SUMMARY_COLS];
+       GtkCTreeNode *node = NULL;
        GHashTable *msgid_table;
        GHashTable *subject_table;
        GSList * cur;
@@ -1974,116 +2013,40 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
        }
        
        if (summaryview->folder_item->threaded) {
-               for (; mlist != NULL; mlist = mlist->next) {
-                       msginfo = (MsgInfo *)mlist->data;
-                       parent = NULL;
+               GNode *root, *gnode;
 
-                       summary_set_header(summaryview, text, msginfo);
+               root = procmsg_get_thread_tree(mlist);
 
-                       /* search parent node for threading */
-                       if (msginfo->inreplyto && *msginfo->inreplyto) {
-                               parent = g_hash_table_lookup
-                                       (msgid_table, msginfo->inreplyto);
-                       }
-                       if (parent == NULL && msginfo->subject &&
-                           g_strncasecmp(msginfo->subject, "Re: ", 4) == 0) {
-                               parent = subject_table_lookup
-                                       (subject_table, msginfo->subject);
-                       }
-                       if(parent) {
-                               parentinfo = gtk_ctree_node_get_row_data(ctree, parent);
-                               if(!MSG_IS_IGNORE_THREAD(msginfo->flags) && parentinfo && MSG_IS_IGNORE_THREAD(parentinfo->flags)) {
-                                       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
-                               }
-                       }
-
-                       node = gtk_ctree_insert_node
-                               (ctree, parent, NULL, text, 2,
-                                NULL, NULL, NULL, NULL, FALSE,
-                                parent ? TRUE : FALSE);
-                       GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
-                       summary_set_marks_func(ctree, node, summaryview);
-                       
-                       if (MSG_GET_COLORLABEL(msginfo->flags))
-                               summary_set_colorlabel_color(ctree, node, MSG_GET_COLORLABEL_VALUE(msginfo->flags));
-
-                       /* preserve previous node if the message is
-                          duplicated */
-                       if (msginfo->msgid && *msginfo->msgid &&
-                           g_hash_table_lookup(msgid_table, msginfo->msgid)
-                           == NULL)
-                               g_hash_table_insert(msgid_table,
-                                                   msginfo->msgid, node);
-                       if (msginfo->subject &&
-                           subject_table_lookup(subject_table,
-                                                msginfo->subject) == NULL) {
-                               subject_table_insert(subject_table,
-                                                    msginfo->subject, node);
-                       }
-
-                       cur_parent = parent;
-                       cur_msginfo = msginfo;
-                       while (cur_parent != NULL) {
-                               parentinfo = gtk_ctree_node_get_row_data(ctree, cur_parent);
-
-                               if (!parentinfo)
-                                       break;
-                               
-                               if (parentinfo->threadscore <
-                                   cur_msginfo->threadscore) {
-                                       gchar * s;
-                                       parentinfo->threadscore =
-                                               cur_msginfo->threadscore;
-#if 0
-                                       s = itos(parentinfo->threadscore);
-                                       gtk_ctree_node_set_text(ctree, cur_parent, S_COL_SCORE, s);
-#endif
-                               }
-                               else break;
-                               
-                               cur_msginfo = parentinfo;
-                               if (cur_msginfo->inreplyto &&
-                                   *cur_msginfo->inreplyto) {
-                                       cur_parent = g_hash_table_lookup(msgid_table, cur_msginfo->inreplyto);
-                               }
-                               if (cur_parent == NULL &&
-                                   cur_msginfo->subject &&
-                                   g_strncasecmp(cur_msginfo->subject,
-                                                 "Re: ", 4) == 0) {
-                                       cur_parent = subject_table_lookup(subject_table, cur_msginfo->subject);
-                               }
-                       }
+               for (gnode = root->children; gnode != NULL;
+                    gnode = gnode->next) {
+                       node = gtk_ctree_insert_gnode
+                               (ctree, NULL, node, gnode,
+                                summary_insert_gnode_func, summaryview);
                }
 
-               /* complete the thread */
-               summary_thread_build(summaryview, TRUE);
+               g_node_destroy(root);
+
+               summary_thread_init(summaryview);
        } else {
+               gchar *text[N_SUMMARY_COLS];
+
+               mlist = g_slist_reverse(mlist);
                for (; mlist != NULL; mlist = mlist->next) {
                        msginfo = (MsgInfo *)mlist->data;
 
                        summary_set_header(summaryview, text, msginfo);
 
                        node = gtk_ctree_insert_node
-                               (ctree, NULL, NULL, text, 2,
+                               (ctree, NULL, node, text, 2,
                                 NULL, NULL, NULL, NULL, FALSE, FALSE);
                        GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
                        summary_set_marks_func(ctree, node, summaryview);
 
-                       if ( MSG_GET_COLORLABEL(msginfo->flags) )
-                         summary_set_colorlabel_color(ctree, node, MSG_GET_COLORLABEL_VALUE(msginfo->flags));
-
-                       if (msginfo->msgid && *msginfo->msgid &&
-                           g_hash_table_lookup(msgid_table, msginfo->msgid)
-                           == NULL)
+                       if (msginfo->msgid)
                                g_hash_table_insert(msgid_table,
                                                    msginfo->msgid, node);
-
-                       if (msginfo->subject &&
-                           subject_table_lookup(subject_table,
-                                                msginfo->subject) == NULL)
-                               subject_table_insert(subject_table,
-                                                    msginfo->subject, node);
                }
+               mlist = g_slist_reverse(mlist);
        }
 
        if (prefs_common.enable_hscrollbar &&
@@ -3232,7 +3195,7 @@ gboolean summary_execute(SummaryView *summaryview)
        }
 
        if (summaryview->folder_item->threaded)
-               summary_thread_build(summaryview, FALSE);
+               summary_thread_build(summaryview);
 
        summaryview->selected = clist->selection ?
                GTK_CTREE_NODE(clist->selection->data) : NULL;
@@ -3416,7 +3379,7 @@ static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 /* thread functions */
 
-void summary_thread_build(SummaryView *summaryview, gboolean init)
+void summary_thread_build(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GtkCTreeNode *node;
@@ -3465,34 +3428,14 @@ void summary_thread_build(SummaryView *summaryview, gboolean init)
 
        node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
 
-       /* for optimization */
-       if (init) {
-               if (prefs_common.expand_thread) {
-                       while (node) {
-                               next = GTK_CTREE_ROW(node)->sibling;
-                               if (GTK_CTREE_ROW(node)->children)
-                                       gtk_ctree_expand(ctree, node);
-                               node = next;
-                       }
-               } else if (prefs_common.bold_unread) {
-                       while (node) {
-                               next = GTK_CTREE_ROW(node)->sibling;
-                               if (GTK_CTREE_ROW(node)->children)
-                                       summary_set_row_marks
-                                               (summaryview, node);
-                               node = next;
-                       }
-               }
-       } else {
-               while (node) {
-                       next = GTK_CTREE_NODE_NEXT(node);
-                       if (prefs_common.expand_thread)
-                               gtk_ctree_expand(ctree, node);
-                       if (prefs_common.bold_unread &&
-                           GTK_CTREE_ROW(node)->children)
-                               summary_set_row_marks(summaryview, node);
-                       node = next;
-               }
+       while (node) {
+               next = GTK_CTREE_NODE_NEXT(node);
+               if (prefs_common.expand_thread)
+                       gtk_ctree_expand(ctree, node);
+               if (prefs_common.bold_unread &&
+                   GTK_CTREE_ROW(node)->children)
+                       summary_set_row_marks(summaryview, node);
+               node = next;
        }
 
        gtk_clist_thaw(GTK_CLIST(ctree));
@@ -3506,6 +3449,29 @@ void summary_thread_build(SummaryView *summaryview, gboolean init)
        summary_unlock(summaryview);
 }
 
+static void summary_thread_init(SummaryView *summaryview)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCTreeNode *node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+       GtkCTreeNode *next;
+
+       if (prefs_common.expand_thread) {
+               while (node) {
+                       next = GTK_CTREE_ROW(node)->sibling;
+                       if (GTK_CTREE_ROW(node)->children)
+                               gtk_ctree_expand(ctree, node);
+                       node = next;
+               }
+       } else if (prefs_common.bold_unread) {
+               while (node) {
+                       next = GTK_CTREE_ROW(node)->sibling;
+                       if (GTK_CTREE_ROW(node)->children)
+                               summary_set_row_marks(summaryview, node);
+                       node = next;
+               }
+       }
+}
+
 void summary_unthread(SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
@@ -3620,10 +3586,12 @@ void summary_filter(SummaryView *summaryview)
                                        summaryview);
                
                gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
-
-               if (prefs_common.immediate_exec)
+               
+               if (prefs_common.immediate_exec) {
+                       summary_unlock(summaryview);
                        summary_execute(summaryview);
-               else
+                       summary_lock(summaryview);
+               } else
                        summary_status_show(summaryview);
        }
        else {
index 49f4bc9..af10f12 100644 (file)
@@ -191,8 +191,7 @@ guint summary_get_current_msgnum  (SummaryView              *summaryview);
 void summary_select_node         (SummaryView          *summaryview,
                                   GtkCTreeNode         *node,
                                   gboolean              display_msg);
-void summary_thread_build        (SummaryView          *summaryview,
-                                  gboolean              init);
+void summary_thread_build        (SummaryView          *summaryview);
 void summary_unthread            (SummaryView          *summaryview);
 void summary_filter              (SummaryView          *summaryview);
 void summary_sort                (SummaryView          *summaryview,