re-implement per-folder message threading
authorPaul Mangan <paul@claws-mail.org>
Sat, 25 Jan 2003 01:30:03 +0000 (01:30 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sat, 25 Jan 2003 01:30:03 +0000 (01:30 +0000)
ChangeLog.claws
configure.ac
src/folder.c
src/folder.h
src/prefs_common.c
src/summaryview.c
src/summaryview.h

index b74b707..d684d5c 100644 (file)
@@ -1,4 +1,13 @@
-2001-01-25 [christoph] 0.8.9claws2
+2003-01-25 [paul]      0.8.9claws3
+
+       * src/folder.[ch]
+         src/summaryview.[ch]
+               re-implement per folder message threading
+               
+       * src/prefs_common.c
+               remove global message threading option
+
+2003-01-25 [christoph] 0.8.9claws2
 
        * po/POTFILES.in
                add pluginwindow and prefswindow
@@ -11,9 +20,8 @@
                0 to tell the folder system it was appened but the UID is
                unknown. Folder system now get's the UID by scaning the folder
                and searching the cache for the Message-ID
-               (closes bug #29 Messages queued, but not sent)
 
-2001-01-25 [paul]      0.8.9claws1
+2003-01-25 [paul]      0.8.9claws1
 
        * codeconv.c
                conv_encode_header():  fix bug when long headers with 8-bit
@@ -28,7 +36,7 @@
                 toggled on or off.
                 Patch by Luke Plant.
 
-2001-01-24 [paul]      0.8.9claws
+2003-01-24 [paul]      0.8.9claws
 
        * sylpheed-0.8.9claws released
        
 
        * src/procmsg.c
                fix infinite loop in procmsg_find_children
-               (closes bug #25 sylpheed crashes on delete.)
 
        Patch submitted by Ivan F. Martinez <ivanfm@users.sourceforge.net>
 
 
        * src/procmsg.c
                update save folder after adding the sent message
-               (closes bug #6 Folder View doesn't refresh for "Sent"-messages)
 
 2003-01-02 [christoph] 0.8.8claws42
 
index 8a8987e..8eb4160 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=9
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws2
+EXTRA_VERSION=claws3
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index a9ad5e4..d3baef7 100644 (file)
@@ -215,6 +215,7 @@ FolderItem *folder_item_new(Folder *folder, const gchar *name, const gchar *path
        item->no_sub = FALSE;
        item->no_select = FALSE;
        item->collapsed = FALSE;
+       item->thread_collapsed = FALSE;
        item->threaded  = TRUE;
        item->ret_rcpt  = FALSE;
        item->opened    = FALSE;
@@ -1604,6 +1605,7 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest)
        /*copy prefs*/
        prefs_folder_item_copy_prefs(src, new_item);
        new_item->collapsed = src->collapsed;
+       new_item->thread_collapsed = src->thread_collapsed;
        new_item->threaded  = src->threaded;
        new_item->ret_rcpt  = src->ret_rcpt;
        new_item->hide_read_msgs = src->hide_read_msgs;
@@ -2224,7 +2226,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        PrefsAccount *account = NULL;
        gboolean no_sub = FALSE, no_select = FALSE, collapsed = FALSE, 
                 threaded = TRUE, apply_sub = FALSE;
-       gboolean ret_rcpt = FALSE, hidereadmsgs = FALSE; /* CLAWS */
+       gboolean ret_rcpt = FALSE, hidereadmsgs = FALSE,
+                thread_collapsed = FALSE; /* CLAWS */
        FolderSortKey sort_key = SORT_BY_NONE;
        FolderSortType sort_type = SORT_ASCENDING;
        gint new = 0, unread = 0, total = 0, unreadmarked = 0;
@@ -2277,6 +2280,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
                        no_select = *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "collapsed"))
                        collapsed = *attr->value == '1' ? TRUE : FALSE;
+               else if (!strcmp(attr->name, "thread_collapsed"))
+                       thread_collapsed =  *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "threaded"))
                        threaded =  *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "hidereadmsgs"))
@@ -2333,6 +2338,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        item->no_sub = no_sub;
        item->no_select = no_select;
        item->collapsed = collapsed;
+       item->thread_collapsed = thread_collapsed;
        item->threaded  = threaded;
        item->hide_read_msgs  = hidereadmsgs;
        item->ret_rcpt  = ret_rcpt;
@@ -2368,7 +2374,7 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
        const gchar *path = NULL;
        PrefsAccount *account = NULL;
        gboolean collapsed = FALSE, threaded = TRUE, apply_sub = FALSE;
-       gboolean ret_rcpt = FALSE; /* CLAWS */
+       gboolean ret_rcpt = FALSE, thread_collapsed = FALSE; /* CLAWS */
 
        if (g_node_depth(node) != 2) return FALSE;
        g_return_val_if_fail(node->data != NULL, FALSE);
@@ -2401,6 +2407,8 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
                        path = attr->value;
                else if (!strcmp(attr->name, "collapsed"))
                        collapsed = *attr->value == '1' ? TRUE : FALSE;
+               else if (!strcmp(attr->name, "thread_collapsed"))
+                       thread_collapsed = *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "threaded"))
                        threaded = *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "account_id")) {
@@ -2423,6 +2431,7 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
        folder->node = node;
        folder_add(folder);
        FOLDER_ITEM(node->data)->collapsed = collapsed;
+       FOLDER_ITEM(node->data)->thread_collapsed = thread_collapsed;
        FOLDER_ITEM(node->data)->threaded  = threaded;
        FOLDER_ITEM(node->data)->account   = account;
        FOLDER_ITEM(node->data)->apply_sub = apply_sub;
@@ -2506,6 +2515,12 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
                        fputs(" no_select=\"1\"", fp);
                if (item->collapsed && node->children)
                        fputs(" collapsed=\"1\"", fp);
+               else
+                       fputs(" collapsed=\"0\"", fp);
+               if (item->thread_collapsed)
+                       fputs(" thread_collapsed=\"1\"", fp);
+               else
+                       fputs(" thread_collapsed=\"0\"", fp);
                if (item->threaded)
                        fputs(" threaded=\"1\"", fp);
                else
@@ -2713,6 +2728,7 @@ void folder_item_restore_persist_prefs(FolderItem *item, GHashTable *pptable)
        prefs_folder_item_read_config(item); 
         
        item->collapsed = pp->collapsed;
+       item->thread_collapsed = pp->thread_collapsed;
        item->threaded  = pp->threaded;
        item->ret_rcpt  = pp->ret_rcpt;
        item->hide_read_msgs = pp->hide_read_msgs;
@@ -2737,6 +2753,7 @@ static void folder_get_persist_prefs_recursive(GNode *node, GHashTable *pptable)
                pp = g_new0(PersistPrefs, 1);
                g_return_if_fail(pp != NULL);
                pp->collapsed = item->collapsed;
+               pp->thread_collapsed = item->thread_collapsed;
                pp->threaded  = item->threaded;
                pp->ret_rcpt  = item->ret_rcpt; 
                pp->hide_read_msgs = item->hide_read_msgs;
index a6668ce..66c9980 100644 (file)
@@ -261,6 +261,7 @@ struct _FolderItem
        guint no_sub         : 1; /* no child allowed?    */
        guint no_select      : 1; /* not selectable?      */
        guint collapsed      : 1; /* collapsed item       */
+       guint thread_collapsed      : 1; /* collapsed item       */
        guint threaded       : 1; /* threaded folder view */
        guint hide_read_msgs : 1; /* hide read messages   */
        guint ret_rcpt       : 1; /* return receipt       */
@@ -291,6 +292,7 @@ typedef struct {
        FolderSortKey   sort_key;
        FolderSortType  sort_type;
        guint           collapsed       : 1;
+       guint           thread_collapsed        : 1;
        guint           threaded        : 1;
        guint           hide_read_msgs  : 1; /* CLAWS */
        guint           ret_rcpt        : 1; /* CLAWS */
index 3c7f90d..9a2a278 100644 (file)
@@ -174,7 +174,6 @@ static struct Display {
 
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_useaddrbook;
-       GtkWidget *chkbtn_expand_thread;
        GtkWidget *entry_datefmt;
 } display;
 
@@ -518,9 +517,6 @@ static PrefParam param[] = {
        {"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},
-       {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL,
-        &display.chkbtn_expand_thread,
-        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
         NULL, NULL, NULL},
@@ -2173,7 +2169,6 @@ static void prefs_display_create(void)
        GtkWidget *vbox2;
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_useaddrbook;
-       GtkWidget *chkbtn_expand_thread;
        GtkWidget *vbox3;
        GtkWidget *label_datefmt;
        GtkWidget *button_datefmt;
@@ -2324,8 +2319,6 @@ static void prefs_display_create(void)
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_useaddrbook,
                 _("Display sender using address book"));
-       PACK_CHECK_BUTTON
-               (vbox2, chkbtn_expand_thread, _("Expand threads"));
 
        PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
 
@@ -2371,7 +2364,6 @@ static void prefs_display_create(void)
        display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj;
 
        display.chkbtn_swapfrom      = chkbtn_swapfrom;
-       display.chkbtn_expand_thread = chkbtn_expand_thread;
        display.chkbtn_useaddrbook   = chkbtn_useaddrbook;
        display.entry_datefmt        = entry_datefmt;
 }
index 4667338..b96e087 100644 (file)
@@ -3695,7 +3695,7 @@ void summary_thread_build(SummaryView *summaryview)
 
        while (node) {
                next = GTK_CTREE_NODE_NEXT(node);
-               if (prefs_common.expand_thread)
+               if (!summaryview->folder_item->thread_collapsed)
                        gtk_ctree_expand(ctree, node);
                if (prefs_common.bold_unread &&
                    GTK_CTREE_ROW(node)->children)
@@ -3724,7 +3724,7 @@ static void summary_thread_init(SummaryView *summaryview)
        GtkCTreeNode *node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
        GtkCTreeNode *next;
 
-       if (prefs_common.expand_thread) {
+       if (!summaryview->folder_item->thread_collapsed) {
                while (node) {
                        next = GTK_CTREE_ROW(node)->sibling;
                        if (GTK_CTREE_ROW(node)->children)
@@ -3857,6 +3857,8 @@ void summary_expand_threads(SummaryView *summaryview)
 
        gtk_clist_thaw(GTK_CLIST(ctree));
 
+       summaryview->thread_collapsed = FALSE;
+
        gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
 }
 
@@ -3874,6 +3876,8 @@ void summary_collapse_threads(SummaryView *summaryview)
        }
 
        gtk_clist_thaw(GTK_CLIST(ctree));
+       
+       summaryview->thread_collapsed = TRUE;
 
        gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
 }
@@ -5362,6 +5366,7 @@ void summary_set_prefs_from_folderitem(SummaryView *summaryview, FolderItem *ite
 
        /* Threading */
        summaryview->threaded = item->threaded;
+       summaryview->thread_collapsed = item->thread_collapsed;
 
        /* Scoring */
        if (global_scoring || item->prefs->scoring) {
@@ -5381,6 +5386,7 @@ void summary_save_prefs_to_folderitem(SummaryView *summaryview, FolderItem *item
 
        /* Threading */
        item->threaded = summaryview->threaded;
+       item->thread_collapsed = summaryview->thread_collapsed;
 }
 
 static gboolean summary_update_msg(gpointer source, gpointer data) 
index c8d7706..67d5a15 100644 (file)
@@ -140,6 +140,7 @@ struct _SummaryView
        FolderSortKey sort_key;
        FolderSortType sort_type;
        guint threaded;
+       guint thread_collapsed;
 
        /* Extra data for summaryview */
        regex_t *simplify_subject_preg;