summarylogtreecommitdiffstats
path: root/sidebar-new.patch
blob: fb265346361154d33f9175472f02431dbc94cfff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 355399bde98203af59d20821f9e840fc056bd383 Mon Sep 17 00:00:00 2001
From: Julius Haertl <jus@bitgrid.net>
Date: Tue, 9 Sep 2014 22:31:49 +0200
Subject: Patch for sidebar iteration functionality

sidebar-new will move the selected folder to the next with new messages.
If the end is reached, it will start at the top.

Useful macros would be:

	macro index <esc>a "<sidebar-new><sidebar-open>"
	macro pager <esc>a "<exit><sidebar-new><sidebar-open>"
---
 OPS         |  1 +
 curs_main.c |  1 +
 functions.h |  2 ++
 pager.c     |  1 +
 sidebar.c   | 10 ++++++++++
 5 files changed, 15 insertions(+)

diff --git a/OPS b/OPS
index 1ed9c96..3ffb82a 100644
--- a/OPS
+++ b/OPS
@@ -187,3 +187,4 @@ OP_SIDEBAR_PREV "go to previous mailbox"
 OP_SIDEBAR_OPEN "open hilighted mailbox"
 OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail"
 OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail"
+OP_SIDEBAR_NEW "iterate though mailboxes with new mail"
diff --git a/curs_main.c b/curs_main.c
index acb106d..2e35f90 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -2328,6 +2328,7 @@ int mutt_index_menu (void)
       case OP_SIDEBAR_PREV:
       case OP_SIDEBAR_NEXT_NEW:
       case OP_SIDEBAR_PREV_NEW:
+      case OP_SIDEBAR_NEW:
         scroll_sidebar(op, menu->menu);
         break;
       default:
diff --git a/functions.h b/functions.h
index 363b4d5..1485080 100644
--- a/functions.h
+++ b/functions.h
@@ -176,6 +176,7 @@ const struct binding_t OpMain[] = { /* map: index */
  { "sidebar-prev",		OP_SIDEBAR_PREV, NULL },
  { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
  { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
+ { "sidebar-new",		OP_SIDEBAR_NEW, NULL },
  { "sidebar-open",		OP_SIDEBAR_OPEN, NULL },
   { NULL,			0,				NULL }
 };
@@ -287,6 +288,7 @@ const struct binding_t OpPager[] = { /* map: pager */
   { "sidebar-prev",	OP_SIDEBAR_PREV, NULL },
   { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
   { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
+  { "sidebar-new",		OP_SIDEBAR_NEW, NULL },
   { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
   { NULL,		0,				NULL }
 };
diff --git a/pager.c b/pager.c
index 8d64fe1..696e55c 100644
--- a/pager.c
+++ b/pager.c
@@ -2791,6 +2791,7 @@ search_next:
       case OP_SIDEBAR_PREV:
       case OP_SIDEBAR_NEXT_NEW:
       case OP_SIDEBAR_PREV_NEW:
+      case OP_SIDEBAR_NEW:
 	scroll_sidebar(ch, MENU_PAGER);
  	break;
 
diff --git a/sidebar.c b/sidebar.c
index c3ea338..eb8ecd2 100644
--- a/sidebar.c
+++ b/sidebar.c
@@ -429,6 +429,16 @@ void scroll_sidebar(int op, int menu)
 				CurBuffy = CurBuffy->next;
 			}
 			break;
+                case OP_SIDEBAR_NEW:
+                	if ( (tmp = exist_next_new()) == NULL)
+				tmp = TopBuffy;
+			if ( tmp->msg_unread == 0 ) {
+				CurBuffy = tmp;
+				tmp = exist_next_new();
+			}
+			if ( tmp != NULL )
+				CurBuffy = tmp;
+			break;
 		default:
 			return;
 	}
-- 
2.6.0.rc0.2.g7662973.dirty