2004-09-03 [colin] 0.9.12cvs92.1
authorColin Leroy <colin@colino.net>
Fri, 3 Sep 2004 09:45:51 +0000 (09:45 +0000)
committerColin Leroy <colin@colino.net>
Fri, 3 Sep 2004 09:45:51 +0000 (09:45 +0000)
* src/prefs_common.c
* src/prefs_common.h
* src/summaryview.c
Sync with HEAD ('mark_as_read_delay' pref)

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/prefs_common.c
src/prefs_common.h
src/summaryview.c

index f6acc6c15ce2f3b4a86ef21d3eee65e32a397724..0fd2b8fc97f71eba0f77962b47481b13f6017655 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-03 [colin]     0.9.12cvs92.1
+
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/summaryview.c
+               Sync with HEAD ('mark_as_read_delay' pref)
+
 2004-09-02 [colin]     0.9.12cvs91.2
 
        * src/common/xml.c
index f8cab7d7bbb02643ade93266610452cd6def4c5a..d55bfc7b64309ebec47fa99f57aea5520f46c63b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.61.2.8 -r 1.61.2.10 src/account.c; ) > 0.9.12cvs90.1.patchset
 ( cvs diff -u -r 1.5.2.10 -r 1.5.2.11 src/gtk/menu.c; ) > 0.9.12cvs91.1.patchset
 ( cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/common/xml.c; ) > 0.9.12cvs91.2.patchset
+( cvs diff -u -r 1.204.2.19 -r 1.204.2.20 src/prefs_common.c; cvs diff -u -r 1.103.2.8 -r 1.103.2.9 src/prefs_common.h; cvs diff -u -r 1.395.2.29 -r 1.395.2.30 src/summaryview.c; ) > 0.9.12cvs92.1.patchset
index e9f244c394f0f245d4569a870e7d372a3224b389..0e8e157ddadc5667c115867b2db9672da545249a 100644 (file)
@@ -11,9 +11,9 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=91
+EXTRA_VERSION=92
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.2
+EXTRA_GTK2_VERSION=.1
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index 5cdbe9a84d04344b5957fb67392d2f5218506789..fc142f64ec7276168f4937d7078faa3cf5e1de48 100644 (file)
@@ -677,6 +677,9 @@ static PrefParam param[] = {
         &prefs_common.mark_as_read_on_new_window,
         P_BOOL, &interface.checkbtn_mark_as_read_on_newwin,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"mark_as_read_delay", "0",
+        &prefs_common.mark_as_read_delay, P_INT, 
+        NULL, NULL, NULL},
        {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
         P_BOOL, &interface.checkbtn_openinbox,
         prefs_set_data_from_toggle, prefs_set_toggle},
index 31de2b38c452cfad96b6d4bda114ad0a05dc9513..9a70d2cf4fd042bc8e7c3443aa8fc58dab453b0b 100644 (file)
@@ -262,6 +262,7 @@ struct _PrefsCommon
        gboolean always_show_msg;
        gboolean open_unread_on_enter;
        gboolean mark_as_read_on_new_window;
+       gboolean mark_as_read_delay;
        gboolean open_inbox_on_inc;
        gboolean immediate_exec;
        NextUnreadMsgDialogShow next_unread_msg_dialog;
index c22da8a615d8acefd5b1c109e00c7e951a8a56f3..237677889aa282a16f4b46034b3de32fa62a10d6 100644 (file)
@@ -2298,13 +2298,52 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row)
        summary_display_msg_full(summaryview, row, FALSE, FALSE);
 }
 
+static void msginfo_mark_as_read (SummaryView *summaryview, MsgInfo *msginfo,
+                                     GtkCTreeNode *row)
+{
+       g_return_if_fail(summaryview != NULL);
+       g_return_if_fail(msginfo != NULL);
+       g_return_if_fail(row != NULL);
+
+       if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) 
+       && procmsg_msg_has_marked_parent(msginfo))
+               summaryview->unreadmarked--;
+       if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
+               procmsg_msginfo_unset_flags
+                       (msginfo, MSG_NEW | MSG_UNREAD, 0);
+               summary_set_row_marks(summaryview, row);
+               gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
+               summary_status_show(summaryview);
+       }
+}
+
+typedef struct  {
+       MsgInfo *msginfo;
+       SummaryView *summaryview;
+       GtkCTreeNode *row;
+} MarkAsReadData;
+
+static int msginfo_mark_as_read_timeout(void *data)
+{
+       MarkAsReadData *mdata = (MarkAsReadData *)data;
+       if (!mdata)
+               return FALSE;
+       
+       if (mdata->msginfo == summary_get_selected_msg(mdata->summaryview))
+               msginfo_mark_as_read(mdata->summaryview, mdata->msginfo,
+                                    mdata->row); 
+
+       g_free(mdata);
+
+       return FALSE;   
+}
+
 static void summary_display_msg_full(SummaryView *summaryview,
                                     GtkCTreeNode *row,
                                     gboolean new_window, gboolean all_headers)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        MsgInfo *msginfo;
-       MsgFlags flags;
        gint val;
 
        if (!new_window) {
@@ -2344,19 +2383,16 @@ static void summary_display_msg_full(SummaryView *summaryview,
                gtkut_ctree_node_move_if_on_the_edge(ctree, row);
        }
 
-       if (val == 0 &&
-           (new_window || !prefs_common.mark_as_read_on_new_window)) {
-               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) 
-               && procmsg_msg_has_marked_parent(msginfo))
-                       summaryview->unreadmarked--;
-               if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
-                       procmsg_msginfo_unset_flags
-                               (msginfo, MSG_NEW | MSG_UNREAD, 0);
-                       summary_set_row_marks(summaryview, row);
-                       gtk_clist_thaw(GTK_CLIST(ctree));
-                       summary_status_show(summaryview);
-                       
-                       flags = msginfo->flags;
+       if (val == 0) {
+               if (prefs_common.mark_as_read_delay) {
+                       MarkAsReadData *data = g_new0(MarkAsReadData, 1);
+                       data->summaryview = summaryview;
+                       data->msginfo = msginfo;
+                       data->row = row;
+                       gtk_timeout_add(prefs_common.mark_as_read_delay * 1000,
+                               msginfo_mark_as_read_timeout, data);
+               } else if (new_window || !prefs_common.mark_as_read_on_new_window) {
+                       msginfo_mark_as_read(summaryview, msginfo, row);
                }
        }