ignore threads
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Jul 2001 19:50:23 +0000 (19:50 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Jul 2001 19:50:23 +0000 (19:50 +0000)
ChangeLog.claws
src/mbox_folder.c
src/pixmaps/ignorethread.xpm [new file with mode: 0644]
src/procmsg.c
src/procmsg.h
src/summaryview.c

index 5667f77..4c3315c 100644 (file)
@@ -1,3 +1,10 @@
+2001-07-02 [christoph]
+
+       * src/mbox_folder.c
+       * src/procmsg.[ch]
+       * src/summaryview.c
+               mark threads for ignoring
+
 2001-07-02 [paul]
 
        0.5.0claws4
index ded6482..374a353 100644 (file)
@@ -1693,9 +1693,9 @@ void mbox_scan_folder(Folder *folder, FolderItem *item)
                        struct _message * msg = (struct _message *) l->data;
                        if (!MSG_IS_REALLY_DELETED(msg->flags))
                                total ++;
-                       if (MSG_IS_NEW(msg->flags))
+                       if (MSG_IS_NEW(msg->flags) && !MSG_IS_IGNORE_THREAD(msg->flags))
                                new ++;
-                       if (MSG_IS_UNREAD(msg->flags))
+                       if (MSG_IS_UNREAD(msg->flags) && !MSG_IS_IGNORE_THREAD(msg->flags))
                                unread ++;
                }
                
diff --git a/src/pixmaps/ignorethread.xpm b/src/pixmaps/ignorethread.xpm
new file mode 100644 (file)
index 0000000..817aa7c
--- /dev/null
@@ -0,0 +1,19 @@
+/* XPM */
+static char * ignorethread_xpm[] = {
+"13 10 6 1",
+"      c None",
+".     c #FF0000",
+"+     c #191919",
+"@     c #B2B2B2",
+"#     c #FFFFFF",
+"$     c #999999",
+"          .  ",
+"    +++++..  ",
+"  ++@@@@..+  ",
+" +#@@$+..@#+ ",
+"+##@$+..$@##+",
+"+##@$..+$@##+",
+" +#@..+$@@#+ ",
+"  +..@@@@++  ",
+"  ..+++++    ",
+"  .          "};
index 9abe958..3a3b0e3 100644 (file)
@@ -403,8 +403,8 @@ static void mark_sum_func(gpointer key, gpointer value, gpointer data)
        MsgFlags flags = GPOINTER_TO_UINT(value);
        struct MarkSum *marksum = data;
 
-       if (MSG_IS_NEW(flags)) (*marksum->new)++;
-       if (MSG_IS_UNREAD(flags)) (*marksum->unread)++;
+       if (MSG_IS_NEW(flags) && !MSG_IS_IGNORE_THREAD(flags)) (*marksum->new)++;
+       if (MSG_IS_UNREAD(flags) && !MSG_IS_IGNORE_THREAD(flags)) (*marksum->unread)++;
        (*marksum->total)++;
 }
 
index 5afe3f6..7a16adc 100644 (file)
@@ -51,6 +51,8 @@ typedef enum
        MSG_LABEL_GREEN   = 1 << 9 | 1 << 8 | 0 << 7,
        MSG_LABEL_BROWN   = 1 << 9 | 1 << 8 | 1 << 7,
 
+       MSG_IGNORE_THREAD = 1 << 10,
+
        /* temporary flags (0xffff0000) */
        MSG_MOVE        = 1 << 16,
        MSG_COPY        = 1 << 17,
@@ -70,8 +72,8 @@ typedef enum
                                         MSG_DELETED   | \
                                         MSG_REPLIED   | \
                                         MSG_FORWARDED | \
-                                         MSG_LABEL     | \
                                          MSG_REALLY_DELETED | \
+                                         MSG_LABEL     | \
                                         MSG_IGNORE_THREAD)
 #define MSG_CACHED_FLAG_MASK           (MSG_MIME)
 
@@ -95,8 +97,8 @@ typedef enum
 #define MSG_IS_MIME(msg)               ((msg & MSG_MIME) != 0)
 #define MSG_IS_NEWS(msg)               ((msg & MSG_NEWS) != 0)
 #define MSG_IS_CACHED(msg)             ((msg & MSG_CACHED) != 0)
-#define MSG_IS_IGNORE_THREAD(msg)      ((msg & MSG_IGNORE_THREAD) != 0)
 #define MSG_GET_LABEL(msg)             (msg & MSG_LABEL)
+#define MSG_IS_IGNORE_THREAD(msg)      ((msg & MSG_IGNORE_THREAD) != 0)
 
 #define WRITE_CACHE_DATA_INT(n, fp) \
        fwrite(&n, sizeof(n), 1, fp)
index 9239610..fa34635 100644 (file)
@@ -84,6 +84,7 @@
 #include "pixmaps/replied.xpm"
 #include "pixmaps/forwarded.xpm"
 #include "pixmaps/clip.xpm"
+#include "pixmaps/ignorethread.xpm"
 
 #define STATUSBAR_PUSH(mainwin, str) \
 { \
@@ -120,6 +121,8 @@ static GdkPixmap *repliedxpm;
 static GdkBitmap *repliedxpmmask;
 static GdkPixmap *forwardedxpm;
 static GdkBitmap *forwardedxpmmask;
+static GdkPixmap *ignorethreadxpm;
+static GdkBitmap *ignorethreadxpmmask;
 
 static GdkPixmap *clipxpm;
 static GdkBitmap *clipxpmmask;
@@ -204,6 +207,8 @@ static void summary_execute_delete  (SummaryView            *summaryview);
 static void summary_execute_delete_func        (GtkCTree               *ctree,
                                         GtkCTreeNode           *node,
                                         gpointer                data);
+static void summary_ignore_thread(SummaryView *summaryview);
+static void summary_unignore_thread(SummaryView *summaryview);
 
 /* thread functions */
 static void summary_thread_func                        (GtkCTree       *ctree,
@@ -320,8 +325,10 @@ static GtkItemFactoryEntry summary_popup_entries[] =
        {N_("/_Mark/_Unmark"),          NULL, summary_unmark,   0, NULL},
        {N_("/_Mark/---"),              NULL, NULL,             0, "<Separator>"},
        {N_("/_Mark/Mark as unr_ead"),  NULL, summary_mark_as_unread, 0, NULL},
-       {N_("/_Mark/Mark as rea_d"),
-                                       NULL, summary_mark_as_read, 0, NULL},
+       {N_("/_Mark/Mark as rea_d"),    NULL, summary_mark_as_read, 0, NULL},
+       {N_("/_Mark/Ignore thread"),    NULL, summary_ignore_thread, 0, NULL},
+       {N_("/_Mark/Unignore thread"),  NULL, summary_unignore_thread, 0, NULL},
+
        {N_("/_Label"),                 NULL, NULL, 0, "<Branch>"},
        {N_("/_Label/None"),            NULL, summary_set_label, MSG_LABEL_NONE, NULL},
        {N_("/_Label/---"),             NULL, NULL,             0, "<Separator>"},
@@ -332,6 +339,7 @@ static GtkItemFactoryEntry summary_popup_entries[] =
        {N_("/_Label/Blue"),            NULL, summary_set_label, MSG_LABEL_BLUE, NULL},
        {N_("/_Label/Green"),           NULL, summary_set_label, MSG_LABEL_GREEN, NULL},
        {N_("/_Label/Brown"),           NULL, summary_set_label, MSG_LABEL_BROWN, NULL},
+
        {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/_Reply"),                 NULL, summary_reply_cb, COMPOSE_REPLY, NULL},
        {N_("/Repl_y to sender"),       NULL, summary_reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
@@ -657,6 +665,8 @@ void summary_init(SummaryView *summaryview)
                      replied_xpm);
        PIXMAP_CREATE(summaryview->ctree, forwardedxpm, forwardedxpmmask,
                      forwarded_xpm);
+       PIXMAP_CREATE(summaryview->ctree, ignorethreadxpm, ignorethreadxpmmask,
+                     ignorethread_xpm);
        PIXMAP_CREATE(summaryview->ctree, clipxpm, clipxpmmask, clip_xpm);
        PIXMAP_CREATE(summaryview->hbox, folderxpm, folderxpmmask,
                      DIRECTORY_OPEN_XPM);
@@ -1066,6 +1076,8 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
 
        menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
        menu_set_sensitive(ifactory, "/Mark/Mark as read",   TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Ignore thread",   TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Unignore thread", TRUE);
 
        menu_set_sensitive(ifactory, "/Label", TRUE);
 
@@ -1091,6 +1103,7 @@ void summary_select_next_unread(SummaryView *summaryview)
                gtk_sctree_unselect_all(GTK_SCTREE(ctree));
                gtk_sctree_select(GTK_SCTREE(ctree), node);
                gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0.0);
+
                if (summaryview->displayed == node)
                        summaryview->displayed = NULL;
                summary_display_msg(summaryview, node, FALSE);
@@ -1218,7 +1231,7 @@ static GtkCTreeNode *summary_find_next_unread_msg(SummaryView *summaryview,
 
        for (; node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
                msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_IS_UNREAD(msginfo->flags)) break;
+               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) break;
        }
 
        return node;
@@ -1408,9 +1421,9 @@ static void summary_set_marks_func(GtkCTree *ctree, GtkCTreeNode *node,
 
        msginfo = gtk_ctree_node_get_row_data(ctree, node);
 
-       if (MSG_IS_NEW(msginfo->flags))
+       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->newmsgs++;
-       if (MSG_IS_UNREAD(msginfo->flags))
+       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->unread++;
        if (MSG_IS_DELETED(msginfo->flags))
                summaryview->deleted++;
@@ -1435,9 +1448,9 @@ static void summary_update_status(SummaryView *summaryview)
             node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
                msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
 
-               if (MSG_IS_NEW(msginfo->flags))
+               if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                        summaryview->newmsgs++;
-               if (MSG_IS_UNREAD(msginfo->flags))
+               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                        summaryview->unread++;
                if (MSG_IS_DELETED(msginfo->flags))
                        summaryview->deleted++;
@@ -1689,6 +1702,18 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
                                parent = subject_table_lookup
                                        (subject_table, msginfo->subject);
                        }
+                       if(parent) {
+                               parentinfo = gtk_ctree_node_get_row_data(ctree, parent);
+                               if(parentinfo && MSG_IS_IGNORE_THREAD(parentinfo->flags)) {
+/*
+                                       if (MSG_IS_NEW(msginfo->flags))
+                                               summaryview->newmsgs--;
+                                       if (MSG_IS_UNREAD(msginfo->flags))
+                                               summaryview->unread--;
+*/
+                                       MSG_SET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+                               }
+                       }
 
                        node = gtk_ctree_insert_node
                                (ctree, parent, NULL, text, 2,
@@ -1982,9 +2007,9 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
        }
        g_free(filename);
 
-       if (MSG_IS_NEW(msginfo->flags))
+       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->newmsgs--;
-       if (MSG_IS_UNREAD(msginfo->flags))
+       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->unread--;
        if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
                MSG_UNSET_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
@@ -2139,7 +2164,10 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
        gtk_ctree_node_set_foreground(ctree, row, &summaryview->color_normal);
 
        /* set new/unread column */
-       if (MSG_IS_NEW(flags)) {
+       if (MSG_IS_IGNORE_THREAD(flags)) {
+               gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
+                                         ignorethreadxpm, ignorethreadxpmmask);
+       } else if (MSG_IS_NEW(flags)) {
                gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
                                          newxpm, newxpmmask);
        } else if (MSG_IS_UNREAD(flags)) {
@@ -2239,9 +2267,9 @@ static void summary_mark_row_as_read(SummaryView *summaryview,
        MsgInfo *msginfo;
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
-       if (MSG_IS_NEW(msginfo->flags))
+       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->newmsgs--;
-       if (MSG_IS_UNREAD(msginfo->flags))
+       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->unread--;
        if (MSG_IS_NEW(msginfo->flags) ||
            MSG_IS_UNREAD(msginfo->flags)) {
@@ -3728,3 +3756,66 @@ static gint summary_cmp_by_score(GtkCList *clist,
        else
                return summary_cmp_by_date(clist, ptr1, ptr2);
 }
+
+static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+{
+       SummaryView *summaryview = (SummaryView *) data;
+       MsgInfo *msginfo;
+
+       msginfo = gtk_ctree_node_get_row_data(ctree, row);
+       if (MSG_IS_NEW(msginfo->flags))
+               summaryview->newmsgs--;
+       if (MSG_IS_UNREAD(msginfo->flags))
+               summaryview->unread--;
+       MSG_SET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+
+       CHANGE_FLAGS(msginfo);
+               
+       summary_set_row_marks(summaryview, row);
+       debug_print(_("Message %d is marked as ignore thread\n"),
+           msginfo->msgnum);
+}
+
+static void summary_ignore_thread(SummaryView *summaryview)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GList *cur;
+
+       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
+               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_ignore_thread_func), summaryview);
+       }
+
+       summary_status_show(summaryview);
+}
+
+static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+{
+       SummaryView *summaryview = (SummaryView *) data;
+       MsgInfo *msginfo;
+
+       msginfo = gtk_ctree_node_get_row_data(ctree, row);
+       if (MSG_IS_NEW(msginfo->flags))
+               summaryview->newmsgs++;
+       if (MSG_IS_UNREAD(msginfo->flags))
+               summaryview->unread++;
+       MSG_UNSET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+
+       CHANGE_FLAGS(msginfo);
+               
+       summary_set_row_marks(summaryview, row);
+       debug_print(_("Message %d is marked as unignore thread\n"),
+           msginfo->msgnum);
+}
+
+static void summary_unignore_thread(SummaryView *summaryview)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GList *cur;
+
+       for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
+               gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_unignore_thread_func), summaryview);
+       }
+
+       summary_status_show(summaryview);
+}
+