diff options
author | Oscar Morante | 2015-06-11 14:34:58 +0300 |
---|---|---|
committer | Oscar Morante | 2015-06-11 14:35:29 +0300 |
commit | e6384b51f68c57d993111a2a0faf8a2bdd69bb32 (patch) | |
tree | 30ecb81ba7e885e11deb6ba536bf6893bacc0c5f /sidebar-newonly.patch | |
download | aur-e6384b51f68c57d993111a2a0faf8a2bdd69bb32.tar.gz |
initial import
Diffstat (limited to 'sidebar-newonly.patch')
-rw-r--r-- | sidebar-newonly.patch | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/sidebar-newonly.patch b/sidebar-newonly.patch new file mode 100644 index 000000000000..f9ff91e4ffd2 --- /dev/null +++ b/sidebar-newonly.patch @@ -0,0 +1,198 @@ +From: Steve Kemp <steve@steve.org.uk> +Date: Tue, 4 Mar 2014 22:07:06 +0100 +Subject: sidebar-newonly + +patches written by Steve Kemp, it adds two new functionalities to the sidebar, +so only the mailbox with new messages will be shown (and/or) selected +See Debian bug http://bugs.debian.org/532510 + +Gbp-Pq: Topic mutt-patched +--- + OPS | 2 ++ + curs_main.c | 2 ++ + functions.h | 4 ++++ + init.h | 5 +++++ + mutt.h | 2 ++ + pager.c | 2 ++ + sidebar.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 7 files changed, 70 insertions(+), 2 deletions(-) + +diff --git a/OPS b/OPS +index b036db9..1ed9c96 100644 +--- a/OPS ++++ b/OPS +@@ -185,3 +185,5 @@ OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page" + OP_SIDEBAR_NEXT "go down to next mailbox" + 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" +diff --git a/curs_main.c b/curs_main.c +index 7b81798..5c58f1c 100644 +--- a/curs_main.c ++++ b/curs_main.c +@@ -2262,6 +2262,8 @@ int mutt_index_menu (void) + case OP_SIDEBAR_SCROLL_DOWN: + case OP_SIDEBAR_NEXT: + case OP_SIDEBAR_PREV: ++ case OP_SIDEBAR_NEXT_NEW: ++ case OP_SIDEBAR_PREV_NEW: + scroll_sidebar(op, menu->menu); + break; + default: +diff --git a/functions.h b/functions.h +index ef8937a..363b4d5 100644 +--- a/functions.h ++++ b/functions.h +@@ -174,6 +174,8 @@ const struct binding_t OpMain[] = { /* map: index */ + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, + { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, + { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, ++ { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; +@@ -283,6 +285,8 @@ const struct binding_t OpPager[] = { /* map: pager */ + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, + { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, + { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, ++ { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; +diff --git a/init.h b/init.h +index b0784d8..e20a24e 100644 +--- a/init.h ++++ b/init.h +@@ -2009,6 +2009,11 @@ struct option_t MuttVars[] = { + ** you're not using IMAP folders, you probably prefer setting this to "/" + ** alone. + */ ++ {"sidebar_newmail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, 0 }, ++ /* ++ ** .pp ++ ** Show only new mail in the sidebar. ++ */ + { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, + /* + ** .pp +diff --git a/mutt.h b/mutt.h +index 61a9612..932ef10 100644 +--- a/mutt.h ++++ b/mutt.h +@@ -525,6 +525,8 @@ enum + OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */ + OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */ + ++ OPTSIDEBARNEWMAILONLY, ++ + OPTMAX + }; + +diff --git a/pager.c b/pager.c +index 469efe4..d372fc0 100644 +--- a/pager.c ++++ b/pager.c +@@ -2789,6 +2789,8 @@ search_next: + case OP_SIDEBAR_SCROLL_DOWN: + case OP_SIDEBAR_NEXT: + case OP_SIDEBAR_PREV: ++ case OP_SIDEBAR_NEXT_NEW: ++ case OP_SIDEBAR_PREV_NEW: + scroll_sidebar(ch, MENU_PAGER); + break; + +diff --git a/sidebar.c b/sidebar.c +index 8f58f85..51a25ca 100644 +--- a/sidebar.c ++++ b/sidebar.c +@@ -269,8 +269,21 @@ int draw_sidebar(int menu) { + SETCOLOR(MT_COLOR_NEW); + else if ( tmp->msg_flagged > 0 ) + SETCOLOR(MT_COLOR_FLAGGED); +- else +- SETCOLOR(MT_COLOR_NORMAL); ++ else { ++ /* make sure the path is either: ++ 1. Containing new mail. ++ 2. The inbox. ++ 3. The current box. ++ */ ++ if ((option (OPTSIDEBARNEWMAILONLY)) && ++ ( (tmp->msg_unread <= 0) && ++ ( tmp != Incoming ) && ++ Context && ++ ( strcmp( tmp->path, Context->path ) != 0 ) ) ) ++ continue; ++ else ++ SETCOLOR(MT_COLOR_NORMAL); ++ } + + move( lines, 0 ); + if ( Context && !strcmp( tmp->path, Context->path ) ) { +@@ -336,6 +349,29 @@ int draw_sidebar(int menu) { + return 0; + } + ++BUFFY * exist_next_new() ++{ ++ BUFFY *tmp = CurBuffy; ++ if(tmp == NULL) return NULL; ++ while (tmp->next != NULL) ++ { ++ tmp = tmp->next; ++ if(tmp->msg_unread) return tmp; ++ } ++ return NULL; ++} ++ ++BUFFY * exist_prev_new() ++{ ++ BUFFY *tmp = CurBuffy; ++ if(tmp == NULL) return NULL; ++ while (tmp->prev != NULL) ++ { ++ tmp = tmp->prev; ++ if(tmp->msg_unread) return tmp; ++ } ++ return NULL; ++} + + void set_buffystats(CONTEXT* Context) + { +@@ -352,18 +388,33 @@ void set_buffystats(CONTEXT* Context) + + void scroll_sidebar(int op, int menu) + { ++ BUFFY *tmp; + if(!SidebarWidth) return; + if(!CurBuffy) return; + + switch (op) { + case OP_SIDEBAR_NEXT: ++ if (!option (OPTSIDEBARNEWMAILONLY)) { + if ( CurBuffy->next == NULL ) return; + CurBuffy = CurBuffy->next; + break; ++ } ++ case OP_SIDEBAR_NEXT_NEW: ++ if ( (tmp = exist_next_new()) == NULL) ++ return; ++ else CurBuffy = tmp; ++ break; + case OP_SIDEBAR_PREV: ++ if (!option (OPTSIDEBARNEWMAILONLY)) { + if ( CurBuffy->prev == NULL ) return; + CurBuffy = CurBuffy->prev; + break; ++ } ++ case OP_SIDEBAR_PREV_NEW: ++ if ( (tmp = exist_prev_new()) == NULL) ++ return; ++ else CurBuffy = tmp; ++ break; + case OP_SIDEBAR_SCROLL_UP: + CurBuffy = TopBuffy; + if ( CurBuffy != Incoming ) { |