enable ability to hide read messages
authorPaul Mangan <paul@claws-mail.org>
Tue, 11 Dec 2001 15:06:46 +0000 (15:06 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 11 Dec 2001 15:06:46 +0000 (15:06 +0000)
AUTHORS
ChangeLog.claws
configure.in
src/folder.c
src/folder.h
src/folderview.c
src/mainwindow.c
src/pixmaps/dir-open-hrm.xpm [new file with mode: 0644]
src/summaryview.c
src/summaryview.h

diff --git a/AUTHORS b/AUTHORS
index 7e734a6..3392c42 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -99,3 +99,4 @@ contributors (beside the above; based on Changelog)
         Jesse Skinner
         Willem van Engen
        Tobias Sandhaas
+       Thomas Link
index 8fb948d..fc15b43 100644 (file)
@@ -1,3 +1,27 @@
+2001-12-11 [paul]      0.6.5claws75
+
+       * src/folder.[ch]
+       * src/folderview.c
+       * src/mainwindow.c
+       * src/summaryview.[ch]
+       * src/pixmaps/open-dir-hrm.xpm  ** NEW FILE **
+               enable ability to hide read messages on per folder basis via 
+               '/Summary/Hide read messages'; when selected, a folder will 
+               have a red open folder icon, instead of a blue icon, if the 
+               folder contains hidden messges
+               submitted by Thomas Link <t.link.tmp200101.gmx.net> 
+
+       * src/mainwindow.c
+               remove '/Message/Forward as attachment' from 
+                main_window_set_menu_sensitive() to prevent debug warning
+
+       * src/folderview.c
+       * src/mainwindow.c
+               Clean up some of the English
+
+       * tools/newscache_clean.pl
+               allow for new 'hidereadmsgs' entry in folderlist.xml
+
 2001-12-11 [paul]      0.6.5claws74
 
        * sync with sylpheed 0.6.5cvs25
index 3dde6a6..4c05a26 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws74
+EXTRA_VERSION=claws75
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 8023d9c..93edfc1 100644 (file)
@@ -1110,7 +1110,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        const gchar *path = NULL;
        PrefsAccount *account = NULL;
        gboolean no_sub = FALSE, no_select = FALSE, collapsed = FALSE, 
-                threaded = TRUE, ret_rcpt = FALSE;
+                threaded = TRUE, ret_rcpt = FALSE, hidereadmsgs = FALSE;
        gint mtime = 0, new = 0, unread = 0, total = 0;
 
        g_return_val_if_fail(node->data != NULL, FALSE);
@@ -1164,6 +1164,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
                        collapsed = *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "threaded"))
                        threaded =  *attr->value == '1' ? TRUE : FALSE;
+               else if (!strcmp(attr->name, "hidereadmsgs"))
+                       hidereadmsgs =  *attr->value == '1' ? TRUE : FALSE;
                else if (!strcmp(attr->name, "reqretrcpt"))
                        ret_rcpt =  *attr->value == '1' ? TRUE : FALSE;
        }
@@ -1179,6 +1181,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
        item->no_select = no_select;
        item->collapsed = collapsed;
        item->threaded  = threaded;
+       item->hide_read_msgs  = hidereadmsgs;
        item->ret_rcpt  = ret_rcpt;
        item->parent = FOLDER_ITEM(node->parent->data);
        item->folder = folder;
@@ -1345,6 +1348,10 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
                        fputs(" threaded=\"1\"", fp);
                else
                        fputs(" threaded=\"0\"", fp);
+               if (item->hide_read_msgs)
+                       fputs(" hidereadmsgs=\"1\"", fp);
+               else
+                       fputs(" hidereadmsgs=\"0\"", fp);
                if (item->ret_rcpt)
                        fputs(" reqretrcpt=\"1\"", fp);
                fprintf(fp,
index 899bdde..adfe9e6 100644 (file)
@@ -216,11 +216,12 @@ struct _FolderItem
        gint last_num;
 
        /* special flags */
-       guint no_sub    : 1; /* no child allowed?    */
-       guint no_select : 1; /* not selectable?      */
-       guint collapsed : 1; /* collapsed item       */
-       guint threaded  : 1; /* threaded folder view */
-       guint ret_rcpt  : 1; /* return receipt       */
+       guint no_sub         : 1; /* no child allowed?    */
+       guint no_select      : 1; /* not selectable?      */
+       guint collapsed      : 1; /* collapsed item       */
+       guint threaded       : 1; /* threaded folder view */
+       guint hide_read_msgs : 1; /* hide read messages   */
+       guint ret_rcpt       : 1; /* return receipt       */
 
        gint op_count;
 
index fcfc9b8..4343f53 100644 (file)
@@ -61,6 +61,7 @@
 #include "pixmaps/outbox.xpm"
 #include "pixmaps/dir-close.xpm"
 #include "pixmaps/dir-open.xpm"
+#include "pixmaps/dir-open-hrm.xpm"
 #include "pixmaps/trash.xpm"
 
 typedef enum
@@ -107,6 +108,8 @@ static GdkPixmap *folderxpm;
 static GdkBitmap *folderxpmmask;
 static GdkPixmap *folderopenxpm;
 static GdkBitmap *folderopenxpmmask;
+static GdkPixmap *folderopenhrmxpm;
+static GdkBitmap *folderopenhrmxpmmask;
 static GdkPixmap *trashxpm;
 static GdkBitmap *trashxpmmask;
 
@@ -250,7 +253,7 @@ static GtkItemFactoryEntry folderview_mail_popup_entries[] =
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/Remove _mailbox"),        NULL, folderview_remove_mailbox_cb, 0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
-       {N_("/_Search messages..."),    NULL, folderview_search_cb, 0, NULL},
+       {N_("/_Search folder..."),      NULL, folderview_search_cb, 0, NULL},
        {N_("/_Property..."),           NULL, folderview_property_cb, 0, NULL},
        {N_("/_Processing..."),         NULL, folderview_processing_cb, 0, NULL},
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
@@ -267,7 +270,7 @@ static GtkItemFactoryEntry folderview_imap_popup_entries[] =
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
        {N_("/Remove _IMAP4 account"),  NULL, folderview_rm_imap_server_cb, 0, NULL},
        {N_("/---"),                    NULL, NULL, 0, "<Separator>"},
-       {N_("/_Search messages..."),    NULL, folderview_search_cb, 0, NULL},
+       {N_("/_Search folder..."),      NULL, folderview_search_cb, 0, NULL},
        {N_("/_Property..."),           NULL, NULL, 0, NULL},
        {N_("/_Processing..."),         NULL, folderview_processing_cb, 0, NULL},
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
@@ -281,9 +284,9 @@ static GtkItemFactoryEntry folderview_news_popup_entries[] =
        {N_("/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/Remove _news account"),    NULL, folderview_rm_news_server_cb, 0, NULL},
        {N_("/---"),                     NULL, NULL, 0, "<Separator>"},
-       {N_("/_Search messages..."),    NULL, folderview_search_cb, 0, NULL},
+       {N_("/_Search folder..."),       NULL, folderview_search_cb, 0, NULL},
        {N_("/_Property..."),            NULL, NULL, 0, NULL},
-       {N_("/_Processing..."),         NULL, folderview_processing_cb, 0, NULL},
+       {N_("/_Processing..."),          NULL, folderview_processing_cb, 0, NULL},
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
 };
 
@@ -447,6 +450,8 @@ void folderview_init(FolderView *folderview)
        PIXMAP_CREATE(ctree, outboxxpm, outboxxpmmask, outbox_xpm);
        PIXMAP_CREATE(ctree, folderxpm, folderxpmmask, dir_close_xpm);
        PIXMAP_CREATE(ctree, folderopenxpm, folderopenxpmmask, dir_open_xpm);
+       PIXMAP_CREATE(ctree, folderopenhrmxpm, folderopenhrmxpmmask,
+                     dir_open_hrm_xpm);
        PIXMAP_CREATE(ctree, trashxpm, trashxpmmask, trash_xpm);
 
        if (!normalfont)
@@ -902,8 +907,13 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
        default:
                xpm = folderxpm;
                mask = folderxpmmask;
-               openxpm = folderopenxpm;
-               openmask = folderopenxpmmask;
+               if (item->hide_read_msgs) {
+                       openxpm = folderopenhrmxpm;
+                       openmask = folderopenhrmxpmmask;
+               } else {
+                       openxpm = folderopenxpm;
+                       openmask = folderopenxpmmask;
+               }
                if (!item->parent) {
                        switch (item->folder->type) {
                        case F_MH:
index 9fa7c3a..9986ffd 100644 (file)
@@ -305,6 +305,10 @@ static void set_charset_cb         (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
 
+static void hide_read_messages   (MainWindow   *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+
 static void thread_cb           (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -433,7 +437,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Edit/Select _all"),              "<control>A", allsel_cb, 0, NULL},
        {N_("/_Edit/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Edit/_Find in current message"), "<control>F", search_cb, 0, NULL},
-       {N_("/_Edit/_Search folder"),           "<control>S", search_cb, 1, NULL},
+       {N_("/_Edit/_Search folder..."),        "<control>S", search_cb, 1, NULL},
 
        {N_("/_View"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_View/_Folder tree"),             NULL, toggle_folder_cb, 0, "<ToggleItem>"},
@@ -565,6 +569,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Message/Open in new _window"),   "<shift><control>N", open_msg_cb, 0, NULL},
 
        {N_("/_Summary"),                       NULL, NULL, 0, "<Branch>"},
+       {N_("/_Summary/_Hide read messages"),   NULL, hide_read_messages, 0, "<ToggleItem>"},
        {N_("/_Summary/_Delete duplicated messages"),
                                                NULL, delete_duplicated_cb,   0, NULL},
        {N_("/_Summary/_Filter messages"),      NULL, filter_cb, 0, NULL},
@@ -648,23 +653,23 @@ static GtkItemFactoryEntry compose_popup_entries[] =
 };
 static GtkItemFactoryEntry reply_popup_entries[] =
 {
-       {N_("/Reply to message with _quoting it"), NULL, reply_cb, COMPOSE_REPLY_WITH_QUOTE, NULL},
-       {N_("/_Reply to message without quoting it"), NULL, reply_cb, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
+       {N_("/Reply with _quote"), NULL, reply_cb, COMPOSE_REPLY_WITH_QUOTE, NULL},
+       {N_("/_Reply"), NULL, reply_cb, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
 };
 static GtkItemFactoryEntry replyall_popup_entries[] =
 {
-       {N_("/Reply to all with _quoting the message"), NULL, reply_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
-       {N_("/_Reply to all without quoting the message"), NULL, reply_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
+       {N_("/Reply to all with _quote"), NULL, reply_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
+       {N_("/_Reply to all"), NULL, reply_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
 };
 static GtkItemFactoryEntry replysender_popup_entries[] =
 {
-       {N_("/Reply to sender with _quoting the message"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
-       {N_("/_Reply to sender without quoting the message"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
+       {N_("/Reply to sender with _quote"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
+       {N_("/_Reply to sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
 };
 static GtkItemFactoryEntry fwd_popup_entries[] =
 {
        {N_("/_Forward message (inline style)"), NULL, reply_cb, COMPOSE_FORWARD_INLINE, NULL},
-       {N_("/Forward message as _attachement"), NULL, reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}
+       {N_("/Forward message as _attachment"), NULL, reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}
 };
 
 
@@ -1446,8 +1451,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/Message/Reply to all"          , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
                {"/Message/Forward"               , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
-               {"/Message/Forward as attachment" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
-        {"/Message/Bounce"               , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Bounce"                , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Open in new window"    , M_SINGLE_TARGET_EXIST},
                {"/Message/Re-edit", M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
                {"/Message/Move...", M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
@@ -2670,6 +2674,15 @@ static void set_charset_cb(MainWindow *mainwin, guint action,
        debug_print(_("forced charset: %s\n"), str ? str : "Auto-Detect");
 }
 
+static void hide_read_messages (MainWindow *mainwin, guint action,
+                               GtkWidget *widget)
+{
+       if (!mainwin->summaryview->folder_item
+           || gtk_object_get_data(GTK_OBJECT(widget), "dont_toggle"))
+               return;
+       summary_toggle_show_read_messages(mainwin->summaryview);
+}
+
 static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        GtkItemFactory *ifactory;
diff --git a/src/pixmaps/dir-open-hrm.xpm b/src/pixmaps/dir-open-hrm.xpm
new file mode 100644 (file)
index 0000000..4dd19c3
--- /dev/null
@@ -0,0 +1,52 @@
+/* XPM */
+static char * dir_open_hrm_xpm[] = {
+"16 16 33 1",
+"      c None",
+".     c #000000",
+"+     c #DE4D7D",
+"@     c #CB326F",
+"#     c #CE3B76",
+"$     c #A93262",
+"%     c #D64385",
+"&     c #BB326C",
+"*     c #D13A76",
+"=     c #B7326A",
+"-     c #A63160",
+";     c #8B283D",
+">     c #752637",
+",     c #5A151D",
+"'     c #AB3265",
+")     c #EF7A95",
+"!     c #F1809B",
+"~     c #EB6C8D",
+"{     c #6C212F",
+"]     c #7A293C",
+"^     c #F1869D",
+"/     c #E76486",
+"(     c #D43B6A",
+"_     c #E65F7C",
+":     c #712434",
+"<     c #EE719A",
+"[     c #972E4C",
+"}     c #D13872",
+"|     c #6C1F30",
+"1     c #EE7595",
+"2     c #852C3F",
+"3     c #DF5089",
+"4     c #AF2A4F",
+"                ",
+"                ",
+"    ....        ",
+"   .+@+@.       ",
+"  .#$#$#$...... ",
+"  .%&*&*&*=-&-;.",
+" ...........>,'.",
+".)!~!~!~!~!~.{].",
+".^/(_(_(_(_(.{:.",
+" .<_(_(_(_(_[.:.",
+" .!}_(_(_(_(_.|.",
+"  .1(_(_(_(_(2..",
+"  .3(4(4(4(4(4..",
+"   ............ ",
+"                ",
+"                "};
index a305bca..fc4038d 100644 (file)
@@ -155,6 +155,9 @@ static void summary_write_cache_func        (GtkCTree               *ctree,
 
 static void summary_set_menu_sensitive (SummaryView            *summaryview);
 
+static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
+                                            guint action);
+
 static guint summary_get_msgnum                (SummaryView            *summaryview,
                                         GtkCTreeNode           *node);
 
@@ -728,6 +731,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
              change_dir(buf) < 0))) {
                g_free(buf);
                debug_print(_("empty folder\n\n"));
+               summary_set_hide_read_msgs_menu(summaryview, FALSE);
                if (is_refresh)
                        messageview_clear(summaryview->messageview);
                summary_clear_all(summaryview);
@@ -766,6 +770,31 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
        }
 
        summaryview->killed_messages = NULL;
+
+       if (summaryview->folder_item->hide_read_msgs) {
+               GSList *not_killed;
+               gint kill_score;
+               
+               summary_set_hide_read_msgs_menu(summaryview, TRUE);
+               not_killed = NULL;
+               for(cur = mlist ; cur != NULL ; cur = g_slist_next(cur)) {
+                       MsgInfo * msginfo = (MsgInfo *) cur->data;
+                       
+                       if ((MSG_IS_UNREAD(msginfo->flags)
+                            || MSG_IS_MARKED(msginfo->flags)
+                            || MSG_IS_LOCKED(msginfo->flags))
+                            && !MSG_IS_IGNORE_THREAD(msginfo->flags))
+                           not_killed = g_slist_append(not_killed, msginfo);
+                       else
+                               summaryview->killed_messages = 
+                                       g_slist_append(summaryview->killed_messages, msginfo);
+               }
+               g_slist_free(mlist);
+               mlist = not_killed;
+       } else {
+               summary_set_hide_read_msgs_menu(summaryview, FALSE);
+       }
+
        if ((global_scoring || item->prefs->scoring) &&
            (item->folder->type == F_NEWS)) {
                GSList *not_killed;
@@ -4802,7 +4831,28 @@ void processing_apply(SummaryView * summaryview)
        }
 }
 
-
+void summary_toggle_show_read_messages(SummaryView *summaryview)
+{
+       if (summaryview->folder_item->hide_read_msgs)
+               summaryview->folder_item->hide_read_msgs = 0;
+       else
+               summaryview->folder_item->hide_read_msgs = 1;
+       summary_show(summaryview, summaryview->folder_item, FALSE);
+}
+static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
+                                            guint action)
+{
+       GtkWidget *widget;
+       widget = gtk_item_factory_get_item(gtk_item_factory_from_widget(summaryview->mainwin->menubar),
+                                          "/Summary/Hide read messages");
+       gtk_object_set_data(GTK_OBJECT(widget), "dont_toggle",
+                           GINT_TO_POINTER(1));
+       gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), action);
+       gtk_object_set_data(GTK_OBJECT(widget), "dont_toggle",
+                           GINT_TO_POINTER(0));
+}
 /*
  * End of Source.
  */
index c46d5b0..761cd5e 100644 (file)
@@ -246,4 +246,6 @@ void summary_set_column_order         (SummaryView          *summaryview);
 
 void processing_apply();
 
+void summary_toggle_show_read_messages (SummaryView *summaryview);
+
 #endif /* __SUMMARY_H__ */