Nico Golde:
authornion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 27 Feb 2005 01:11:32 +0000 (01:11 +0000)
committernion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 27 Feb 2005 01:11:32 +0000 (01:11 +0000)
  integrated patch to show next mailbox with new mail in the sidebar

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@97 e385b8ad-14ed-0310-8656-cc95a2468c6d

ChangeLog.mutt-ng
OPS
curs_main.c
doc/manual.sgml.head
functions.h
pager.c
sidebar.c

index 4ef59a5..d8de501 100644 (file)
@@ -1,5 +1,9 @@
 Changes specific to mutt-ng:
 
+2005-02-27
+  * integrated patch to highlight the next mailbox which includes new mail in
+  sidebar
+
 2005-02-24:
   * Integrated another sidebar fix and a build fix from Rocco Rutte.
   * Implemented feature request that the number of flagged messages is shown in the sidebar
diff --git a/OPS b/OPS
index 9d3c079..4bf0ab2 100644 (file)
--- a/OPS
+++ b/OPS
@@ -200,5 +200,7 @@ OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
 OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
 OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
 OP_SIDEBAR_NEXT "go down to next mailbox"
+OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail"
 OP_SIDEBAR_PREV "go to previous mailbox"
+OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail"
 OP_SIDEBAR_OPEN "open hilighted mailbox"
index 5981766..0fc4e0b 100644 (file)
@@ -2394,6 +2394,8 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
       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:
index 52f624e..017dd5b 100644 (file)
@@ -2195,6 +2195,7 @@ The available functions are:
 sidebar-scroll-up      Scrolls the mailbox list up 1 page
 sidebar-scroll-down    Scrolls the mailbox list down 1 page
 sidebar-next           Hilights the next mailbox
+sidebar-next-new       Hilights the next mailbox with new mail
 sidebar-previous       Hilights the previous mailbox
 sidebar-open           Opens the currently hilighted mailbox
 </tscreen></verb>
index 9047248..4bf22ee 100644 (file)
@@ -175,6 +175,8 @@ struct binding_t OpMain[] = {
   { "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 }
 };
@@ -288,6 +290,8 @@ struct binding_t OpPager[] = {
   { "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/pager.c b/pager.c
index 4b1c48a..58e0e2a 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2747,7 +2747,9 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
          case OP_SIDEBAR_SCROLL_UP:
          case OP_SIDEBAR_SCROLL_DOWN:
          case OP_SIDEBAR_NEXT:
+         case OP_SIDEBAR_NEXT_NEW:
          case OP_SIDEBAR_PREV:
+         case OP_SIDEBAR_PREV_NEW:
            scroll_sidebar(ch, MENU_PAGER);
                break;
       default:
index c71090e..5089989 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -303,24 +303,63 @@ 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;
 
   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 ) {