option to disable threading by subject
authorColin Leroy <colin@colino.net>
Tue, 4 Feb 2003 20:57:27 +0000 (20:57 +0000)
committerColin Leroy <colin@colino.net>
Tue, 4 Feb 2003 20:57:27 +0000 (20:57 +0000)
ChangeLog.claws
configure.ac
src/prefs_common.c
src/prefs_common.h
src/procmsg.c
src/summaryview.c

index 571b484989356088fd3d6061a5c2e1228c018880..a658f71eaadf9573bacd49af1f3ac494a7c8892f 100644 (file)
@@ -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
index 90ea2decb6f460fb447b85e58482e35a9cfb292d..b419028437ffee258024f0662dd0a8442b94333c 100644 (file)
@@ -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
index b27665bff9d4d054b0eb1c522d7790566bd9f69d..ffd921fb96035bb4bb100af08c1f674d04d7b16b 100644 (file)
@@ -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;
 }
 
index 6a6bc58c927315bc09fe1da373fbbc3b68386498..ade5c8b5b582863d20ddf08803442fecb3ea1722 100644 (file)
@@ -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;
index a471bc2f404db9a9e92228a2f8d35128d64f23e2..5f8c915bd6674fe93c37f8807ae49cd5b55c473d 100644 (file)
@@ -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);
 
index 98e6339fcd0b312248bce179a8a6519f94b72520..26302671db508724e6f077b795bcda6fd9209e38 100644 (file)
@@ -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);