X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sidebar.c;h=bbc2c60a0dc1ea323feaf24995ace7a7bebcb441;hp=c71090e7d8b941babd0864e86b3ee37df0db5dca;hb=b661011c5210796beaf103676c0d24b87f1a2787;hpb=f6aab6b0c36b70826d4b66ac2454d219ed04eb6e diff --git a/sidebar.c b/sidebar.c index c71090e..bbc2c60 100644 --- a/sidebar.c +++ b/sidebar.c @@ -303,24 +303,64 @@ 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 scroll_sidebar(int op, int menu) { - if(!SidebarWidth) return; - if(!CurBuffy) return; + BUFFY *tmp; + + if(!SidebarWidth) return; + if(!CurBuffy) return; switch (op) { case OP_SIDEBAR_NEXT: if ( CurBuffy->next == NULL ) return; CurBuffy = CurBuffy->next; break; + case OP_SIDEBAR_NEXT_NEW: + if ( (tmp = exist_next_new()) == NULL) + { + if (CurBuffy->next == NULL) return; + CurBuffy = CurBuffy->next; + } + else CurBuffy = tmp; + break; case OP_SIDEBAR_PREV: - if ( CurBuffy == Incoming ) return; + if ( CurBuffy->prev == NULL ) return; + CurBuffy = CurBuffy->prev; + break; + case OP_SIDEBAR_PREV_NEW: + if ( (tmp = exist_prev_new()) == NULL) { - BUFFY *tmp = Incoming; - while ( tmp->next && strcmp(tmp->next->path, CurBuffy->path) ) tmp = tmp->next; - CurBuffy = tmp; + if(CurBuffy->prev == NULL) return; + CurBuffy = CurBuffy->prev; } + else CurBuffy = tmp; break; + case OP_SIDEBAR_SCROLL_UP: CurBuffy = TopBuffy; if ( CurBuffy != Incoming ) {