From: Colin Leroy Date: Tue, 4 Feb 2003 20:57:27 +0000 (+0000) Subject: option to disable threading by subject X-Git-Tag: rel_0_8_10~21 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=1d8cc742ef1baed47a650d293b64258f18c4ac5b option to disable threading by subject --- diff --git a/ChangeLog.claws b/ChangeLog.claws index 571b48498..a658f71ea 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,10 @@ +2003-02-04 [colin] 0.8.9claws41 + + * src/prefs_common.[ch] + src/procmsg.c + src/summaryview.c + Add an option to disable threading by subject + 2003-02-04 [christoph] 0.8.9claws40 * src/inc.c diff --git a/configure.ac b/configure.ac index 90ea2decb..b41902843 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=9 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws40 +EXTRA_VERSION=claws41 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/prefs_common.c b/src/prefs_common.c index b27665bff..ffd921fb9 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -174,6 +174,7 @@ static struct Display { GtkWidget *chkbtn_swapfrom; GtkWidget *chkbtn_useaddrbook; + GtkWidget *chkbtn_threadsubj; GtkWidget *entry_datefmt; } display; @@ -514,6 +515,9 @@ static PrefParam param[] = { {"use_address_book", "TRUE", &prefs_common.use_addr_book, P_BOOL, &display.chkbtn_useaddrbook, prefs_set_data_from_toggle, prefs_set_toggle}, + {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL, + &display.chkbtn_threadsubj, + prefs_set_data_from_toggle, prefs_set_toggle}, {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format, P_STRING, &display.entry_datefmt, prefs_set_data_from_entry, prefs_set_entry}, @@ -2169,6 +2173,7 @@ static void prefs_display_create(void) GtkWidget *vbox2; GtkWidget *chkbtn_swapfrom; GtkWidget *chkbtn_useaddrbook; + GtkWidget *chkbtn_threadsubj; GtkWidget *vbox3; GtkWidget *label_datefmt; GtkWidget *button_datefmt; @@ -2319,6 +2324,9 @@ static void prefs_display_create(void) PACK_CHECK_BUTTON (vbox2, chkbtn_useaddrbook, _("Display sender using address book")); + PACK_CHECK_BUTTON + (vbox2, chkbtn_threadsubj, + _("Thread using subject in addition to standard headers")); PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); @@ -2365,6 +2373,7 @@ static void prefs_display_create(void) display.chkbtn_swapfrom = chkbtn_swapfrom; display.chkbtn_useaddrbook = chkbtn_useaddrbook; + display.chkbtn_threadsubj = chkbtn_threadsubj; display.entry_datefmt = entry_datefmt; } diff --git a/src/prefs_common.h b/src/prefs_common.h index 6a6bc58c9..ade5c8b5b 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -143,6 +143,7 @@ struct _PrefsCommon gboolean enable_hscrollbar; gboolean bold_unread; gboolean enable_thread; + gboolean thread_by_subject; ToolbarStyle toolbar_style; gboolean show_statusbar; diff --git a/src/procmsg.c b/src/procmsg.c index a471bc2f4..5f8c915bd 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -576,20 +576,22 @@ GNode *procmsg_get_thread_tree(GSList *mlist) g_hash_table_lookup(msgid_table, msgid) == NULL) g_hash_table_insert(msgid_table, (gchar *)msgid, node); - subject = msginfo->subject; - found_subject = subject_table_lookup(subject_table, - (gchar *) subject); - if (found_subject == NULL) - subject_table_insert(subject_table, (gchar *) subject, - node); - else { - /* replace if msg in table is older than current one - * can add here more stuff. */ - if ( ((MsgInfo*)(found_subject->data))->date_t > - ((MsgInfo*)(node->data))->date_t ) { - subject_table_remove(subject_table, (gchar *) subject); - subject_table_insert(subject_table, (gchar *) subject, node); - } + if (prefs_common.thread_by_subject) { + subject = msginfo->subject; + found_subject = subject_table_lookup(subject_table, + (gchar *) subject); + if (found_subject == NULL) + subject_table_insert(subject_table, (gchar *) subject, + node); + else { + /* replace if msg in table is older than current one + * can add here more stuff. */ + if ( ((MsgInfo*)(found_subject->data))->date_t > + ((MsgInfo*)(node->data))->date_t ) { + subject_table_remove(subject_table, (gchar *) subject); + subject_table_insert(subject_table, (gchar *) subject, node); + } + } } } @@ -616,34 +618,36 @@ GNode *procmsg_get_thread_tree(GSList *mlist) * threaded by subject line. we need to handle this in a special way to prevent * circular reference from a node that has already been threaded by IN-REPLY-TO * but is also in the subject line hash table */ - for (node = root->children; node != NULL; ) { - next = node->next; - msginfo = (MsgInfo *) node->data; - parent = NULL; - if (subject_is_reply(msginfo->subject)) { - parent = subject_table_lookup(subject_table, - msginfo->subject); - /* the node may already be threaded by IN-REPLY-TO, - so go up in the tree to find the parent node */ - if (parent != NULL) { - if (g_node_is_ancestor(node, parent)) - parent = NULL; - if (parent == node) - parent = NULL; - } - - if (parent) { - g_node_unlink(node); - g_node_append(parent, node); - /* CLAWS: ignore thread */ - if (MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) { - g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, procmsg_ignore_node, NULL); + if (prefs_common.thread_by_subject) { + for (node = root->children; node != NULL; ) { + next = node->next; + msginfo = (MsgInfo *) node->data; + parent = NULL; + if (subject_is_reply(msginfo->subject)) { + parent = subject_table_lookup(subject_table, + msginfo->subject); + /* the node may already be threaded by IN-REPLY-TO, + so go up in the tree to find the parent node */ + if (parent != NULL) { + if (g_node_is_ancestor(node, parent)) + parent = NULL; + if (parent == node) + parent = NULL; } - } - } - node = next; - } + if (parent) { + g_node_unlink(node); + g_node_append(parent, node); + /* CLAWS: ignore thread */ + if (MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) { + g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, procmsg_ignore_node, NULL); + } + } + } + node = next; + } + } + g_hash_table_destroy(subject_table); g_hash_table_destroy(msgid_table); diff --git a/src/summaryview.c b/src/summaryview.c index 98e6339fc..26302671d 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -3717,7 +3717,7 @@ void summary_thread_build(SummaryView *summaryview) msginfo->inreplyto); } - if (parent == NULL) { + if (prefs_common.thread_by_subject && parent == NULL) { parent = subject_table_lookup (summaryview->subject_table, msginfo->subject);